From 8c6ba46740b46380942536d4b1ffe8d6fd1073e8 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 22 Apr 2024 07:47:55 +0200 Subject: [PATCH 01/53] Update repository for FastDDS 3.0.0 compatibility Signed-off-by: Lucia Echevarria --- ddspipe_core/CMakeLists.txt | 9 - .../payload/PayloadPoolMediator.hpp | 4 +- .../ddspipe_core/logging/DdsLogConsumer.hpp | 12 +- .../producers/StatusMonitorProducer.hpp | 12 +- .../producers/TopicsMonitorProducer.hpp | 12 +- .../ddspipe_core/types/dds/DomainId.hpp | 3 +- .../types/dynamic_types/schema.hpp | 6 +- .../types/dynamic_types/types.hpp | 4 +- .../logging/{v2/LogEntry.h => LogEntry.hpp} | 204 +- .../types/logging/{v1 => }/LogEntryCdrAux.hpp | 14 +- .../types/logging/{v2 => }/LogEntryCdrAux.ipp | 67 +- .../logging/{v2 => }/LogEntryPubSubTypes.h | 21 +- .../logging/LogEntryTypeObjectSupport.hpp | 54 + .../ddspipe_core/types/logging/v1/LogEntry.h | 332 -- .../types/logging/v1/LogEntryCdrAux.ipp | 165 - .../types/logging/v1/LogEntryPubSubTypes.h | 140 - .../types/logging/v1/LogEntryTypeObject.h | 82 - .../types/logging/v2/LogEntryCdrAux.hpp | 56 - .../types/logging/v2/LogEntryTypeObject.h | 82 - .../types/logging/v2/LogEntryv1.h | 337 -- ...onitoringStatus.h => MonitoringStatus.hpp} | 211 +- .../{v1 => }/MonitoringStatusCdrAux.hpp | 7 +- .../{v2 => }/MonitoringStatusCdrAux.ipp | 52 +- .../{v2 => }/MonitoringStatusPubSubTypes.h | 19 +- .../MonitoringStatusTypeObjectSupport.hpp | 61 + .../monitoring/status/v1/MonitoringStatus.h | 396 --- .../status/v1/MonitoringStatusCdrAux.ipp | 208 -- .../status/v1/MonitoringStatusPubSubTypes.h | 221 -- .../status/v1/MonitoringStatusTypeObject.h | 76 - .../status/v2/MonitoringStatusCdrAux.hpp | 56 - .../status/v2/MonitoringStatusTypeObject.h | 76 - .../monitoring/status/v2/MonitoringStatusv1.h | 401 --- ...onitoringTopics.h => MonitoringTopics.hpp} | 426 ++- .../{v1 => }/MonitoringTopicsCdrAux.hpp | 17 +- .../{v1 => }/MonitoringTopicsCdrAux.ipp | 123 +- .../{v1 => }/MonitoringTopicsPubSubTypes.h | 30 +- .../MonitoringTopicsTypeObjectSupport.hpp | 68 + .../monitoring/topics/v1/MonitoringTopics.h | 689 ---- .../topics/v1/MonitoringTopicsTypeObject.h | 89 - .../topics/v2/MonitoringTopicsCdrAux.hpp | 69 - .../topics/v2/MonitoringTopicsCdrAux.ipp | 331 -- .../topics/v2/MonitoringTopicsPubSubTypes.h | 315 -- .../topics/v2/MonitoringTopicsTypeObject.h | 89 - .../monitoring/topics/v2/MonitoringTopicsv1.h | 697 ---- ddspipe_core/package.xml | 2 +- ddspipe_core/project_settings.cmake | 4 +- .../src/cpp/communication/dds/Track.cpp | 10 +- .../src/cpp/communication/rpc/RpcBridge.cpp | 8 +- ddspipe_core/src/cpp/core/DdsPipe.cpp | 16 +- .../src/cpp/dynamic/DiscoveryDatabase.cpp | 2 +- .../payload/PayloadPoolMediator.cpp | 2 +- .../src/cpp/logging/DdsLogConsumer.cpp | 9 +- ddspipe_core/src/cpp/monitoring/Monitor.cpp | 15 +- .../cpp/types/dynamic_types/schema_idl.cpp | 184 +- .../cpp/types/dynamic_types/schema_msg.cpp | 139 +- .../logging/{v1 => }/LogEntryPubSubTypes.cxx | 39 +- .../logging/LogEntryTypeObjectSupport.cxx | 580 ++++ .../src/cpp/types/logging/v1/LogEntry.cxx | 476 --- .../types/logging/v1/LogEntryTypeObject.cxx | 622 ---- .../src/cpp/types/logging/v2/LogEntry.cxx | 289 -- .../types/logging/v2/LogEntryPubSubTypes.cxx | 230 -- .../types/logging/v2/LogEntryTypeObject.cxx | 622 ---- .../src/cpp/types/logging/v2/LogEntryv1.cxx | 480 --- .../{v1 => }/MonitoringStatusPubSubTypes.cxx | 51 +- .../MonitoringStatusTypeObjectSupport.cxx | 527 +++ .../monitoring/status/v1/MonitoringStatus.cxx | 465 --- .../status/v1/MonitoringStatusTypeObject.cxx | 487 --- .../monitoring/status/v2/MonitoringStatus.cxx | 275 -- .../status/v2/MonitoringStatusPubSubTypes.cxx | 411 --- .../status/v2/MonitoringStatusTypeObject.cxx | 487 --- .../status/v2/MonitoringStatusv1.cxx | 469 --- .../{v1 => }/MonitoringTopicsPubSubTypes.cxx | 66 +- .../MonitoringTopicsTypeObjectSupport.cxx | 2361 +++++++++++++ .../monitoring/topics/v1/MonitoringTopics.cxx | 969 ------ .../topics/v1/MonitoringTopicsTypeObject.cxx | 878 ----- .../monitoring/topics/v2/MonitoringTopics.cxx | 597 ---- .../topics/v2/MonitoringTopicsPubSubTypes.cxx | 599 ---- .../topics/v2/MonitoringTopicsTypeObject.cxx | 878 ----- .../topics/v2/MonitoringTopicsv1.cxx | 973 ------ .../test/unittest/core/ddspipe/CMakeLists.txt | 4 +- .../dynamic/allowed_topic_list/CMakeLists.txt | 2 +- .../participants_database/CMakeLists.txt | 2 +- .../test/unittest/efficiency/CMakeLists.txt | 6 +- .../logging/dds_consumer/CMakeLists.txt | 4 +- .../dds_consumer/DdsLogConsumerTest.cpp | 24 +- .../logging/std_consumer/CMakeLists.txt | 4 +- .../monitoring/status/dds/CMakeLists.txt | 4 +- .../status/dds/DdsMonitorStatusTest.cpp | 13 +- .../monitoring/status/logging/CMakeLists.txt | 4 +- .../monitoring/topics/dds/CMakeLists.txt | 4 +- .../topics/dds/DdsMonitorTopicsTest.cpp | 19 +- .../monitoring/topics/logging/CMakeLists.txt | 4 +- .../types/dynamic_types/CMakeLists.txt | 19 +- .../types/dynamic_types/dtypes_idl_tests.cpp | 16 +- .../types/dynamic_types/dtypes_msg_tests.cpp | 16 +- .../types/dynamic_types/types/all_types.hpp | 96 + .../{v1 => }/idls/arrays_and_sequences.idl | 0 .../{v1 => }/idls/basic_array_struct.idl | 0 .../types/{v1 => }/idls/basic_struct.idl | 0 .../types/{v1 => }/idls/char_sequence.idl | 0 .../{v1 => }/idls/complex_nested_arrays.idl | 0 .../types/{v1 => }/idls/enum_struct.idl | 0 .../{v1 => }/idls/float_bounded_sequence.idl | 0 .../types/{v1 => }/idls/hello_world.idl | 0 .../types/{v1 => }/idls/map_struct.idl | 0 .../types/{v1 => }/idls/numeric_array.idl | 0 .../types/{v1 => }/idls/union_struct.idl | 0 .../{v1 => }/msgs/arrays_and_sequences.msg | 0 .../{v1 => }/msgs/basic_array_struct.msg | 0 .../types/{v1 => }/msgs/basic_struct.msg | 0 .../types/{v1 => }/msgs/char_sequence.msg | 0 .../{v1 => }/msgs/complex_nested_arrays.msg | 0 .../{v1 => }/msgs/float_bounded_sequence.msg | 0 .../types/{v1 => }/msgs/hello_world.msg | 0 .../types/{v1 => }/msgs/numeric_array.msg | 0 .../arrays_and_sequences.hpp} | 240 +- .../arrays_and_sequencesCdrAux.hpp | 6 +- .../arrays_and_sequencesCdrAux.ipp | 4 - .../arrays_and_sequencesPubSubTypes.cxx | 19 +- .../arrays_and_sequencesPubSubTypes.h | 14 +- .../arrays_and_sequencesTypeObjectSupport.cxx | 1176 +++++++ .../arrays_and_sequencesTypeObjectSupport.hpp | 61 + .../basic_array_struct.hpp} | 210 +- .../type_objects/basic_array_structCdrAux.hpp | 6 +- .../type_objects/basic_array_structCdrAux.ipp | 4 - .../basic_array_structPubSubTypes.cxx | 19 +- .../basic_array_structPubSubTypes.h | 14 +- .../basic_array_structTypeObjectSupport.cxx | 622 ++++ .../basic_array_structTypeObjectSupport.hpp | 61 + .../basic_struct.hpp} | 167 +- .../type_objects/basic_structCdrAux.hpp | 6 +- .../type_objects/basic_structCdrAux.ipp | 4 - .../type_objects/basic_structPubSubTypes.cxx | 19 +- .../type_objects/basic_structPubSubTypes.h | 14 +- .../basic_structTypeObjectSupport.cxx | 335 ++ .../basic_structTypeObjectSupport.hpp | 61 + .../char_sequence.hpp} | 104 +- .../type_objects/char_sequenceCdrAux.hpp | 6 +- .../type_objects/char_sequenceCdrAux.ipp | 4 - .../type_objects/char_sequencePubSubTypes.cxx | 16 +- .../type_objects/char_sequencePubSubTypes.h | 11 +- .../char_sequenceTypeObjectSupport.cxx | 238 ++ .../char_sequenceTypeObjectSupport.hpp | 54 + .../complex_nested_arrays.hpp} | 403 ++- .../complex_nested_arraysCdrAux.hpp | 12 +- .../complex_nested_arraysCdrAux.ipp | 10 - .../complex_nested_arraysPubSubTypes.cxx | 31 +- .../complex_nested_arraysPubSubTypes.h | 26 +- ...complex_nested_arraysTypeObjectSupport.cxx | 3079 +++++++++++++++++ ...complex_nested_arraysTypeObjectSupport.hpp | 75 + .../enum_struct.hpp} | 125 +- .../type_objects/enum_structCdrAux.hpp | 4 +- .../type_objects/enum_structCdrAux.ipp | 2 - .../type_objects/enum_structPubSubTypes.cxx | 14 +- .../type_objects/enum_structPubSubTypes.h | 11 +- .../enum_structTypeObjectSupport.cxx | 264 ++ .../enum_structTypeObjectSupport.hpp | 54 + .../float_bounded_sequence.hpp} | 104 +- .../float_bounded_sequenceCdrAux.hpp | 6 +- .../float_bounded_sequenceCdrAux.ipp | 4 - .../float_bounded_sequencePubSubTypes.cxx | 16 +- .../float_bounded_sequencePubSubTypes.h | 11 +- ...loat_bounded_sequenceTypeObjectSupport.cxx | 238 ++ ...loat_bounded_sequenceTypeObjectSupport.hpp | 54 + .../hello_world.hpp} | 124 +- .../type_objects/hello_worldCdrAux.hpp | 4 +- .../type_objects/hello_worldCdrAux.ipp | 2 - .../type_objects/hello_worldPubSubTypes.cxx | 14 +- .../type_objects/hello_worldPubSubTypes.h | 9 +- .../hello_worldTypeObjectSupport.cxx | 248 ++ .../hello_worldTypeObjectSupport.hpp | 54 + .../map_struct.hpp} | 103 +- .../type_objects/map_structCdrAux.hpp | 8 +- .../type_objects/map_structCdrAux.ipp | 4 - .../type_objects/map_structPubSubTypes.cxx | 16 +- .../type_objects/map_structPubSubTypes.h | 11 +- .../map_structTypeObjectSupport.cxx | 337 ++ .../map_structTypeObjectSupport.hpp | 54 + .../numeric_array.hpp} | 103 +- .../type_objects/numeric_arrayCdrAux.hpp | 4 +- .../type_objects/numeric_arrayCdrAux.ipp | 2 - .../type_objects/numeric_arrayPubSubTypes.cxx | 14 +- .../type_objects/numeric_arrayPubSubTypes.h | 9 +- .../numeric_arrayTypeObjectSupport.cxx | 242 ++ .../numeric_arrayTypeObjectSupport.hpp | 54 + .../types/type_objects/union_struct.hpp | 676 ++++ .../type_objects/union_structCdrAux.hpp | 8 +- .../type_objects/union_structCdrAux.ipp | 101 +- .../type_objects/union_structPubSubTypes.cxx | 19 +- .../type_objects/union_structPubSubTypes.h | 14 +- .../union_structTypeObjectSupport.cxx | 815 +++++ .../union_structTypeObjectSupport.hpp | 61 + .../dynamic_types/types/v1/all_types.hpp | 97 - .../v1/type_objects/arrays_and_sequences.cxx | 520 --- .../v1/type_objects/arrays_and_sequences.h | 427 --- .../arrays_and_sequencesPubSubTypes.cxx | 309 -- .../arrays_and_sequencesPubSubTypes.h | 165 - .../arrays_and_sequencesTypeObject.cxx | 487 --- .../arrays_and_sequencesTypeObject.h | 72 - .../v1/type_objects/basic_array_struct.cxx | 442 --- .../v1/type_objects/basic_array_struct.h | 395 --- .../basic_array_structPubSubTypes.cxx | 309 -- .../basic_array_structPubSubTypes.h | 165 - .../basic_array_structTypeObject.cxx | 450 --- .../basic_array_structTypeObject.h | 72 - .../types/v1/type_objects/basic_struct.cxx | 339 -- .../types/v1/type_objects/basic_struct.h | 355 -- .../type_objects/basic_structPubSubTypes.cxx | 309 -- .../v1/type_objects/basic_structPubSubTypes.h | 165 - .../type_objects/basic_structTypeObject.cxx | 380 -- .../v1/type_objects/basic_structTypeObject.h | 72 - .../types/v1/type_objects/char_sequence.cxx | 200 -- .../types/v1/type_objects/char_sequence.h | 214 -- .../type_objects/char_sequencePubSubTypes.cxx | 169 - .../type_objects/char_sequencePubSubTypes.h | 101 - .../type_objects/char_sequenceTypeObject.cxx | 215 -- .../v1/type_objects/char_sequenceTypeObject.h | 65 - .../v1/type_objects/complex_nested_arrays.cxx | 881 ----- .../v1/type_objects/complex_nested_arrays.h | 747 ---- .../complex_nested_arraysPubSubTypes.cxx | 589 ---- .../complex_nested_arraysPubSubTypes.h | 293 -- .../complex_nested_arraysTypeObject.cxx | 856 ----- .../complex_nested_arraysTypeObject.h | 86 - .../types/v1/type_objects/enum_struct.cxx | 229 -- .../types/v1/type_objects/enum_struct.h | 239 -- .../type_objects/enum_structPubSubTypes.cxx | 170 - .../v1/type_objects/enum_structPubSubTypes.h | 105 - .../v1/type_objects/enum_structTypeObject.cxx | 470 --- .../v1/type_objects/enum_structTypeObject.h | 68 - .../type_objects/float_bounded_sequence.cxx | 200 -- .../v1/type_objects/float_bounded_sequence.h | 214 -- .../float_bounded_sequencePubSubTypes.cxx | 169 - .../float_bounded_sequencePubSubTypes.h | 101 - .../float_bounded_sequenceTypeObject.cxx | 215 -- .../float_bounded_sequenceTypeObject.h | 65 - .../types/v1/type_objects/hello_world.cxx | 239 -- .../types/v1/type_objects/hello_world.h | 234 -- .../type_objects/hello_worldPubSubTypes.cxx | 169 - .../v1/type_objects/hello_worldPubSubTypes.h | 101 - .../v1/type_objects/hello_worldTypeObject.cxx | 248 -- .../v1/type_objects/hello_worldTypeObject.h | 65 - .../types/v1/type_objects/map_struct.cxx | 194 -- .../types/v1/type_objects/map_struct.h | 215 -- .../v1/type_objects/map_structPubSubTypes.cxx | 169 - .../v1/type_objects/map_structPubSubTypes.h | 104 - .../v1/type_objects/map_structTypeObject.cxx | 220 -- .../v1/type_objects/map_structTypeObject.h | 63 - .../types/v1/type_objects/numeric_array.cxx | 197 -- .../types/v1/type_objects/numeric_array.h | 214 -- .../type_objects/numeric_arrayPubSubTypes.cxx | 169 - .../type_objects/numeric_arrayPubSubTypes.h | 101 - .../type_objects/numeric_arrayTypeObject.cxx | 215 -- .../v1/type_objects/numeric_arrayTypeObject.h | 65 - .../types/v1/type_objects/union_struct.cxx | 642 ---- .../types/v1/type_objects/union_struct.h | 421 --- .../type_objects/union_structPubSubTypes.cxx | 170 - .../v1/type_objects/union_structPubSubTypes.h | 105 - .../type_objects/union_structTypeObject.cxx | 512 --- .../v1/type_objects/union_structTypeObject.h | 68 - .../dynamic_types/types/v2/all_types.hpp | 97 - .../types/v2/idls/arrays_and_sequences.idl | 12 - .../types/v2/idls/basic_array_struct.idl | 11 - .../types/v2/idls/basic_struct.idl | 9 - .../types/v2/idls/char_sequence.idl | 4 - .../types/v2/idls/complex_nested_arrays.idl | 23 - .../types/v2/idls/enum_struct.idl | 12 - .../types/v2/idls/float_bounded_sequence.idl | 4 - .../types/v2/idls/hello_world.idl | 5 - .../types/v2/idls/map_struct.idl | 4 - .../types/v2/idls/numeric_array.idl | 4 - .../types/v2/idls/union_struct.idl | 15 - .../types/v2/msgs/arrays_and_sequences.msg | 7 - .../types/v2/msgs/basic_array_struct.msg | 6 - .../types/v2/msgs/basic_struct.msg | 4 - .../types/v2/msgs/char_sequence.msg | 1 - .../types/v2/msgs/complex_nested_arrays.msg | 14 - .../types/v2/msgs/float_bounded_sequence.msg | 1 - .../types/v2/msgs/hello_world.msg | 2 - .../types/v2/msgs/numeric_array.msg | 1 - .../v2/type_objects/arrays_and_sequences.cxx | 341 -- .../arrays_and_sequencesTypeObject.cxx | 512 --- .../arrays_and_sequencesTypeObject.h | 72 - .../type_objects/arrays_and_sequencesv1.cxx | 575 --- .../v2/type_objects/arrays_and_sequencesv1.h | 438 --- .../v2/type_objects/basic_array_struct.cxx | 287 -- .../basic_array_structTypeObject.cxx | 481 --- .../basic_array_structTypeObject.h | 72 - .../v2/type_objects/basic_array_structv1.cxx | 486 --- .../v2/type_objects/basic_array_structv1.h | 403 --- .../types/v2/type_objects/basic_struct.cxx | 219 -- .../type_objects/basic_structTypeObject.cxx | 411 --- .../v2/type_objects/basic_structTypeObject.h | 72 - .../types/v2/type_objects/basic_structv1.cxx | 373 -- .../types/v2/type_objects/basic_structv1.h | 361 -- .../types/v2/type_objects/char_sequence.cxx | 140 - .../type_objects/char_sequenceTypeObject.cxx | 230 -- .../v2/type_objects/char_sequenceTypeObject.h | 67 - .../types/v2/type_objects/char_sequencev1.cxx | 247 -- .../types/v2/type_objects/char_sequencev1.h | 224 -- .../v2/type_objects/complex_nested_arrays.cxx | 569 --- .../complex_nested_arraysTypeObject.cxx | 909 ----- .../complex_nested_arraysTypeObject.h | 88 - .../type_objects/complex_nested_arraysv1.cxx | 932 ----- .../v2/type_objects/complex_nested_arraysv1.h | 760 ---- .../types/v2/type_objects/enum_struct.cxx | 162 - .../v2/type_objects/enum_structTypeObject.cxx | 496 --- .../v2/type_objects/enum_structTypeObject.h | 70 - .../types/v2/type_objects/enum_structv1.cxx | 285 -- .../types/v2/type_objects/enum_structv1.h | 246 -- .../type_objects/float_bounded_sequence.cxx | 140 - .../float_bounded_sequenceTypeObject.cxx | 230 -- .../float_bounded_sequenceTypeObject.h | 67 - .../type_objects/float_bounded_sequencev1.cxx | 247 -- .../type_objects/float_bounded_sequencev1.h | 224 -- .../types/v2/type_objects/hello_world.cxx | 172 - .../v2/type_objects/hello_worldTypeObject.cxx | 263 -- .../v2/type_objects/hello_worldTypeObject.h | 65 - .../types/v2/type_objects/hello_worldv1.cxx | 290 -- .../types/v2/type_objects/hello_worldv1.h | 243 -- .../types/v2/type_objects/map_struct.cxx | 140 - .../v2/type_objects/map_structTypeObject.cxx | 230 -- .../v2/type_objects/map_structTypeObject.h | 67 - .../types/v2/type_objects/map_structv1.cxx | 268 -- .../types/v2/type_objects/map_structv1.h | 224 -- .../types/v2/type_objects/numeric_array.cxx | 138 - .../type_objects/numeric_arrayTypeObject.cxx | 228 -- .../v2/type_objects/numeric_arrayTypeObject.h | 65 - .../types/v2/type_objects/numeric_arrayv1.cxx | 239 -- .../types/v2/type_objects/numeric_arrayv1.h | 222 -- .../types/v2/type_objects/union_struct.cxx | 554 --- .../types/v2/type_objects/union_struct.h | 357 -- .../type_objects/union_structTypeObject.cxx | 547 --- .../v2/type_objects/union_structTypeObject.h | 72 - .../types/v2/type_objects/union_structv1.cxx | 780 ----- .../types/v2/type_objects/union_structv1.h | 437 --- .../unittest/types/endpoint/CMakeLists.txt | 4 +- .../test/unittest/types/topic/CMakeLists.txt | 4 +- .../participant/dds/CommonParticipant.hpp | 13 +- .../dynamic_types/DynTypesParticipant.hpp | 31 +- .../dynamic_types/ISchemaHandler.hpp | 4 +- .../reader/dds/CommonReader.hpp | 1 + .../reader/rtps/CommonReader.hpp | 1 + .../testing/entities/mock_entities.hpp | 1 + .../writer/rtps/CommonWriter.hpp | 4 +- ddspipe_participants/package.xml | 2 +- ddspipe_participants/project_settings.cmake | 4 +- .../XmlParticipantConfiguration.cpp | 4 +- .../cpp/participant/dds/CommonParticipant.cpp | 16 +- .../cpp/participant/dds/XmlParticipant.cpp | 29 +- .../dynamic_types/DynTypesParticipant.cpp | 104 +- .../src/cpp/reader/auxiliar/BaseReader.cpp | 3 +- .../src/cpp/reader/auxiliar/BlankReader.cpp | 3 +- .../cpp/reader/auxiliar/InternalReader.cpp | 5 +- .../src/cpp/reader/dds/CommonReader.cpp | 15 +- .../src/cpp/reader/rtps/CommonReader.cpp | 14 +- .../cpp/testing/entities/mock_entities.cpp | 6 +- .../src/cpp/types/address/Address.cpp | 2 +- .../src/cpp/types/dds/TopicDataType.cpp | 1 - .../src/cpp/writer/auxiliar/BaseWriter.cpp | 6 +- .../src/cpp/writer/auxiliar/BlankWriter.cpp | 2 +- .../cpp/writer/auxiliar/RtpsEchoWriter.cpp | 2 +- .../src/cpp/writer/dds/CommonWriter.cpp | 13 +- .../cpp/writer/dynamic_types/SchemaWriter.cpp | 4 +- .../writer/dynamic_types/TypeObjectWriter.cpp | 7 +- .../src/cpp/writer/rpc/SimpleWriter.cpp | 2 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 10 +- .../src/cpp/xml/XmlHandler.cpp | 26 +- .../src/cpp/xml/XmlHandlerConfiguration.cpp | 2 +- ddspipe_yaml/package.xml | 2 +- ddspipe_yaml/project_settings.cmake | 2 +- .../unittest/entities/address/CMakeLists.txt | 4 +- .../unittest/entities/guid/CMakeLists.txt | 2 +- .../unittest/entities/topic/CMakeLists.txt | 2 +- .../entities/transport/CMakeLists.txt | 4 +- .../forwarding_routes/routes/CMakeLists.txt | 2 +- .../topic_routes/CMakeLists.txt | 2 +- .../log_configuration/CMakeLists.txt | 2 +- .../yaml_reader/monitoring/CMakeLists.txt | 2 +- .../yaml_reader/scalar/CMakeLists.txt | 2 +- .../test/unittest/yaml_writer/CMakeLists.txt | 4 +- 380 files changed, 15404 insertions(+), 51289 deletions(-) rename ddspipe_core/include/ddspipe_core/types/logging/{v2/LogEntry.h => LogEntry.hpp} (64%) rename ddspipe_core/include/ddspipe_core/types/logging/{v1 => }/LogEntryCdrAux.hpp (95%) rename ddspipe_core/include/ddspipe_core/types/logging/{v2 => }/LogEntryCdrAux.ipp (69%) rename ddspipe_core/include/ddspipe_core/types/logging/{v2 => }/LogEntryPubSubTypes.h (92%) create mode 100644 ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp delete mode 100644 ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntry.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryCdrAux.ipp delete mode 100644 ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryPubSubTypes.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryTypeObject.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryCdrAux.hpp delete mode 100644 ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryTypeObject.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryv1.h rename ddspipe_core/include/ddspipe_core/types/monitoring/status/{v2/MonitoringStatus.h => MonitoringStatus.hpp} (65%) rename ddspipe_core/include/ddspipe_core/types/monitoring/status/{v1 => }/MonitoringStatusCdrAux.hpp (95%) rename ddspipe_core/include/ddspipe_core/types/monitoring/status/{v2 => }/MonitoringStatusCdrAux.ipp (81%) rename ddspipe_core/include/ddspipe_core/types/monitoring/status/{v2 => }/MonitoringStatusPubSubTypes.h (92%) create mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatus.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusCdrAux.ipp delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusPubSubTypes.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusTypeObject.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusCdrAux.hpp delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusTypeObject.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusv1.h rename ddspipe_core/include/ddspipe_core/types/monitoring/topics/{v2/MonitoringTopics.h => MonitoringTopics.hpp} (60%) rename ddspipe_core/include/ddspipe_core/types/monitoring/topics/{v1 => }/MonitoringTopicsCdrAux.hpp (89%) rename ddspipe_core/include/ddspipe_core/types/monitoring/topics/{v1 => }/MonitoringTopicsCdrAux.ipp (70%) rename ddspipe_core/include/ddspipe_core/types/monitoring/topics/{v1 => }/MonitoringTopicsPubSubTypes.h (91%) create mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopics.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsTypeObject.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.hpp delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.ipp delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsTypeObject.h delete mode 100644 ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsv1.h rename ddspipe_core/src/cpp/types/logging/{v1 => }/LogEntryPubSubTypes.cxx (90%) create mode 100644 ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx delete mode 100644 ddspipe_core/src/cpp/types/logging/v1/LogEntry.cxx delete mode 100644 ddspipe_core/src/cpp/types/logging/v1/LogEntryTypeObject.cxx delete mode 100644 ddspipe_core/src/cpp/types/logging/v2/LogEntry.cxx delete mode 100644 ddspipe_core/src/cpp/types/logging/v2/LogEntryPubSubTypes.cxx delete mode 100644 ddspipe_core/src/cpp/types/logging/v2/LogEntryTypeObject.cxx delete mode 100644 ddspipe_core/src/cpp/types/logging/v2/LogEntryv1.cxx rename ddspipe_core/src/cpp/types/monitoring/status/{v1 => }/MonitoringStatusPubSubTypes.cxx (90%) create mode 100644 ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatus.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatusTypeObject.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatus.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusPubSubTypes.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusTypeObject.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusv1.cxx rename ddspipe_core/src/cpp/types/monitoring/topics/{v1 => }/MonitoringTopicsPubSubTypes.cxx (91%) create mode 100644 ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopics.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopicsTypeObject.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopics.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsTypeObject.cxx delete mode 100644 ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsv1.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/arrays_and_sequences.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/basic_array_struct.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/basic_struct.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/char_sequence.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/complex_nested_arrays.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/enum_struct.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/float_bounded_sequence.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/hello_world.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/map_struct.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/numeric_array.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/idls/union_struct.idl (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/arrays_and_sequences.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/basic_array_struct.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/basic_struct.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/char_sequence.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/complex_nested_arrays.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/float_bounded_sequence.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/hello_world.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v1 => }/msgs/numeric_array.msg (100%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/arrays_and_sequences.h => type_objects/arrays_and_sequences.hpp} (66%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/arrays_and_sequencesCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/arrays_and_sequencesCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/arrays_and_sequencesPubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/arrays_and_sequencesPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/basic_array_struct.h => type_objects/basic_array_struct.hpp} (67%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_array_structCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_array_structCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_array_structPubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_array_structPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/basic_struct.h => type_objects/basic_struct.hpp} (69%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_structCdrAux.hpp (98%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_structCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_structPubSubTypes.cxx (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/basic_structPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/char_sequence.h => type_objects/char_sequence.hpp} (74%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/char_sequenceCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/char_sequenceCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/char_sequencePubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/char_sequencePubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/complex_nested_arrays.h => type_objects/complex_nested_arrays.hpp} (66%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/complex_nested_arraysCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/complex_nested_arraysCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/complex_nested_arraysPubSubTypes.cxx (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/complex_nested_arraysPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/enum_struct.h => type_objects/enum_struct.hpp} (68%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/enum_structCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/enum_structCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/enum_structPubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/enum_structPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/float_bounded_sequence.h => type_objects/float_bounded_sequence.hpp} (72%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/float_bounded_sequenceCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/float_bounded_sequenceCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/float_bounded_sequencePubSubTypes.cxx (95%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/float_bounded_sequencePubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/hello_world.h => type_objects/hello_world.hpp} (69%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/hello_worldCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/hello_worldCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/hello_worldPubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/hello_worldPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/map_struct.h => type_objects/map_struct.hpp} (75%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/map_structCdrAux.hpp (93%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/map_structCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/map_structPubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/map_structPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2/type_objects/numeric_array.h => type_objects/numeric_array.hpp} (73%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/numeric_arrayCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/numeric_arrayCdrAux.ipp (99%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/numeric_arrayPubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/numeric_arrayPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/union_structCdrAux.hpp (97%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/union_structCdrAux.ipp (72%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/union_structPubSubTypes.cxx (96%) rename ddspipe_core/test/unittest/types/dynamic_types/types/{v2 => }/type_objects/union_structPubSubTypes.h (94%) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/all_types.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/all_types.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/arrays_and_sequences.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_array_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/char_sequence.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/complex_nested_arrays.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/enum_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/float_bounded_sequence.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/hello_world.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/map_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/numeric_array.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/union_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/arrays_and_sequences.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_array_struct.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_struct.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/char_sequence.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/complex_nested_arrays.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/float_bounded_sequence.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/hello_world.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/numeric_array.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequences.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequence.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arrays.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequence.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_world.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_array.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.h delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.h diff --git a/ddspipe_core/CMakeLists.txt b/ddspipe_core/CMakeLists.txt index 0670face..ba9bd015 100644 --- a/ddspipe_core/CMakeLists.txt +++ b/ddspipe_core/CMakeLists.txt @@ -70,15 +70,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.h*" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) - list(FILTER SOURCES_FILES EXCLUDE REGEX "v2/") - list(FILTER HEADERS_FILES EXCLUDE REGEX "v2/") -else() - list(FILTER SOURCES_FILES EXCLUDE REGEX "v1/") - list(FILTER HEADERS_FILES EXCLUDE REGEX "v1/") -endif() - # Compile C++ library compile_library( "${PROJECT_SOURCE_DIR}/src/cpp" # Source directory diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp index ee4d3bc1..61c2864f 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -119,7 +119,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool * @return false if something went wrong */ DDSPIPE_CORE_DllAPI - utils::ReturnCode write( + fastdds::dds::ReturnCode_t write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, const fastrtps::rtps::InstanceHandle_t& handle); diff --git a/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp b/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp index 2e90a149..a5c416cf 100644 --- a/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp +++ b/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp @@ -29,15 +29,9 @@ #include #include -#if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) - #include - #include - #include -#else - #include - #include - #include -#endif // if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) +#include +#include +#include namespace eprosima { namespace ddspipe { diff --git a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp index 7e169cd2..f17c3d1a 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp +++ b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp @@ -23,15 +23,9 @@ #include #include -#if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) - #include - #include - #include -#else - #include - #include - #include -#endif // if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) +#include +#include +#include // DDSPIPE MONITOR MACROS diff --git a/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp b/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp index f97ebe1a..c2a740ed 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp +++ b/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp @@ -29,15 +29,9 @@ #include #include -#if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) - #include - #include - #include -#else - #include - #include - #include -#endif // if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) +#include +#include +#include // Macro to notify that a message has been received in a topic by a participant. diff --git a/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp b/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp index aff1ee13..3d93179e 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp @@ -14,7 +14,8 @@ #pragma once -#include +#include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp index b61b64ba..31beb747 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include #include @@ -31,7 +31,7 @@ namespace idl { DDSPIPE_CORE_DllAPI std::string generate_idl_schema( - const fastrtps::types::DynamicType_ptr& dynamic_type); + const fastdds::dds::DynamicType::_ref_type& dynamic_type); } /* namespace idl */ @@ -39,7 +39,7 @@ namespace msg { DDSPIPE_CORE_DllAPI std::string generate_ros2_schema( - const fastrtps::types::DynamicType_ptr& dynamic_type); + const fastdds::dds::DynamicType::_ref_type& dynamic_type); } /* namespace msg */ diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp index b16c371b..5ac15468 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp @@ -14,7 +14,7 @@ #pragma once -#include +#include #include #include @@ -35,7 +35,7 @@ struct DynamicTypeData : public core::IRoutingData DDSPIPE_CORE_DllAPI virtual types::TopicInternalTypeDiscriminator internal_type_discriminator() const noexcept override; - fastrtps::types::DynamicType_ptr dynamic_type{nullptr}; + fastdds::dds::DynamicType::_ref_type dynamic_type{nullptr}; }; DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntry.h b/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp similarity index 64% rename from ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntry.h rename to ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp index 5f8932b8..9979ea7f 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntry.h +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp @@ -13,32 +13,19 @@ // limitations under the License. /*! - * @file LogEntry.h + * @file LogEntry.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "LogEntryv1.h" +#ifndef _FAST_DDS_GENERATED_LOGENTRY_HPP_ +#define _FAST_DDS_GENERATED_LOGENTRY_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_LOGENTRY_H_ -#define _FAST_DDS_GENERATED_LOGENTRY_H_ - -#include -#include #include -#include #include -#include - +#include #include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,15 +51,6 @@ #define LOGENTRY_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - const int32_t UNDEFINED = 0x10000000; const int32_t SAMPLE_LOST = 0x10000001; const int32_t TOPIC_MISMATCH_TYPE = 0x10000002; @@ -81,14 +59,12 @@ const int32_t TOPIC_MISMATCH_QOS = 0x10000003; * @brief This class represents the enumeration Kind defined by the user in the IDL file. * @ingroup LogEntry */ -enum Kind : uint32_t +enum class Kind : uint32_t { Info, Warning, Error }; - - /*! * @brief This class represents the structure LogEntry defined by the user in the IDL file. * @ingroup LogEntry @@ -100,73 +76,138 @@ class LogEntry /*! * @brief Default constructor. */ - eProsima_user_DllExport LogEntry(); + eProsima_user_DllExport LogEntry() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~LogEntry(); + eProsima_user_DllExport ~LogEntry() + { + } /*! * @brief Copy constructor. * @param x Reference to the object LogEntry that will be copied. */ eProsima_user_DllExport LogEntry( - const LogEntry& x); + const LogEntry& x) + { + m_event = x.m_event; + + m_kind = x.m_kind; + + m_category = x.m_category; + + m_message = x.m_message; + + m_timestamp = x.m_timestamp; + + } /*! * @brief Move constructor. * @param x Reference to the object LogEntry that will be copied. */ eProsima_user_DllExport LogEntry( - LogEntry&& x) noexcept; + LogEntry&& x) noexcept + { + m_event = x.m_event; + m_kind = x.m_kind; + m_category = std::move(x.m_category); + m_message = std::move(x.m_message); + m_timestamp = std::move(x.m_timestamp); + } /*! * @brief Copy assignment. * @param x Reference to the object LogEntry that will be copied. */ eProsima_user_DllExport LogEntry& operator =( - const LogEntry& x); + const LogEntry& x) + { + + m_event = x.m_event; + + m_kind = x.m_kind; + + m_category = x.m_category; + + m_message = x.m_message; + + m_timestamp = x.m_timestamp; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object LogEntry that will be copied. */ eProsima_user_DllExport LogEntry& operator =( - LogEntry&& x) noexcept; + LogEntry&& x) noexcept + { + + m_event = x.m_event; + m_kind = x.m_kind; + m_category = std::move(x.m_category); + m_message = std::move(x.m_message); + m_timestamp = std::move(x.m_timestamp); + return *this; + } /*! * @brief Comparison operator. * @param x LogEntry object to compare. */ eProsima_user_DllExport bool operator ==( - const LogEntry& x) const; + const LogEntry& x) const + { + return (m_event == x.m_event && + m_kind == x.m_kind && + m_category == x.m_category && + m_message == x.m_message && + m_timestamp == x.m_timestamp); + } /*! * @brief Comparison operator. * @param x LogEntry object to compare. */ eProsima_user_DllExport bool operator !=( - const LogEntry& x) const; + const LogEntry& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member event * @param _event New value for member event */ eProsima_user_DllExport void event( - int32_t _event); + int32_t _event) + { + m_event = _event; + } /*! * @brief This function returns the value of member event * @return Value of member event */ - eProsima_user_DllExport int32_t event() const; + eProsima_user_DllExport int32_t event() const + { + return m_event; + } /*! * @brief This function returns a reference to member event * @return Reference to member event */ - eProsima_user_DllExport int32_t& event(); + eProsima_user_DllExport int32_t& event() + { + return m_event; + } /*! @@ -174,19 +215,28 @@ class LogEntry * @param _kind New value for member kind */ eProsima_user_DllExport void kind( - Kind _kind); + Kind _kind) + { + m_kind = _kind; + } /*! * @brief This function returns the value of member kind * @return Value of member kind */ - eProsima_user_DllExport Kind kind() const; + eProsima_user_DllExport Kind kind() const + { + return m_kind; + } /*! * @brief This function returns a reference to member kind * @return Reference to member kind */ - eProsima_user_DllExport Kind& kind(); + eProsima_user_DllExport Kind& kind() + { + return m_kind; + } /*! @@ -194,26 +244,38 @@ class LogEntry * @param _category New value to be copied in member category */ eProsima_user_DllExport void category( - const std::string& _category); + const std::string& _category) + { + m_category = _category; + } /*! * @brief This function moves the value in member category * @param _category New value to be moved in member category */ eProsima_user_DllExport void category( - std::string&& _category); + std::string&& _category) + { + m_category = std::move(_category); + } /*! * @brief This function returns a constant reference to member category * @return Constant reference to member category */ - eProsima_user_DllExport const std::string& category() const; + eProsima_user_DllExport const std::string& category() const + { + return m_category; + } /*! * @brief This function returns a reference to member category * @return Reference to member category */ - eProsima_user_DllExport std::string& category(); + eProsima_user_DllExport std::string& category() + { + return m_category; + } /*! @@ -221,26 +283,38 @@ class LogEntry * @param _message New value to be copied in member message */ eProsima_user_DllExport void message( - const std::string& _message); + const std::string& _message) + { + m_message = _message; + } /*! * @brief This function moves the value in member message * @param _message New value to be moved in member message */ eProsima_user_DllExport void message( - std::string&& _message); + std::string&& _message) + { + m_message = std::move(_message); + } /*! * @brief This function returns a constant reference to member message * @return Constant reference to member message */ - eProsima_user_DllExport const std::string& message() const; + eProsima_user_DllExport const std::string& message() const + { + return m_message; + } /*! * @brief This function returns a reference to member message * @return Reference to member message */ - eProsima_user_DllExport std::string& message(); + eProsima_user_DllExport std::string& message() + { + return m_message; + } /*! @@ -248,39 +322,51 @@ class LogEntry * @param _timestamp New value to be copied in member timestamp */ eProsima_user_DllExport void timestamp( - const std::string& _timestamp); + const std::string& _timestamp) + { + m_timestamp = _timestamp; + } /*! * @brief This function moves the value in member timestamp * @param _timestamp New value to be moved in member timestamp */ eProsima_user_DllExport void timestamp( - std::string&& _timestamp); + std::string&& _timestamp) + { + m_timestamp = std::move(_timestamp); + } /*! * @brief This function returns a constant reference to member timestamp * @return Constant reference to member timestamp */ - eProsima_user_DllExport const std::string& timestamp() const; + eProsima_user_DllExport const std::string& timestamp() const + { + return m_timestamp; + } /*! * @brief This function returns a reference to member timestamp * @return Reference to member timestamp */ - eProsima_user_DllExport std::string& timestamp(); + eProsima_user_DllExport std::string& timestamp() + { + return m_timestamp; + } + + private: int32_t m_event{0}; - Kind m_kind{::Info}; + Kind m_kind{Kind::Info}; std::string m_category; std::string m_message; std::string m_timestamp; }; -#endif // _FAST_DDS_GENERATED_LOGENTRY_H_ - +#endif // _FAST_DDS_GENERATED_LOGENTRY_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.hpp similarity index 95% rename from ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryCdrAux.hpp rename to ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.hpp index 84c5a1d5..7ad98a12 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryCdrAux.hpp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ #define _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ -#include +#include "LogEntry.hpp" constexpr uint32_t LogEntry_max_cdr_typesize {792UL}; constexpr uint32_t LogEntry_max_key_cdr_typesize {4UL}; @@ -34,17 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - - - - - - - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const LogEntry& data); @@ -54,3 +43,4 @@ eProsima_user_DllExport void serialize_key( } // namespace eprosima #endif // _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ + diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp similarity index 69% rename from ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryCdrAux.ipp rename to ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp index f7f8a6b4..ef467901 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp @@ -34,17 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - - - - - - - - - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -61,20 +50,20 @@ eProsima_user_DllExport size_t calculate_serialized_size( current_alignment)}; - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.event(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.event(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.kind(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.kind(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.category(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), + data.category(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), - data.message(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), + data.message(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), - data.timestamp(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), + data.timestamp(), current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); @@ -99,7 +88,7 @@ eProsima_user_DllExport void serialize( << eprosima::fastcdr::MemberId(2) << data.category() << eprosima::fastcdr::MemberId(3) << data.message() << eprosima::fastcdr::MemberId(4) << data.timestamp() - ; +; scdr.end_serialize_type(current_state); } @@ -116,25 +105,25 @@ eProsima_user_DllExport void deserialize( bool ret_value = true; switch (mid.id) { - case 0: - dcdr >> data.event(); - break; + case 0: + dcdr >> data.event(); + break; - case 1: - dcdr >> data.kind(); - break; + case 1: + dcdr >> data.kind(); + break; - case 2: - dcdr >> data.category(); - break; + case 2: + dcdr >> data.category(); + break; - case 3: - dcdr >> data.message(); - break; + case 3: + dcdr >> data.message(); + break; - case 4: - dcdr >> data.timestamp(); - break; + case 4: + dcdr >> data.timestamp(); + break; default: ret_value = false; @@ -150,7 +139,7 @@ void serialize_key( { static_cast(scdr); static_cast(data); - scdr << data.event(); + scdr << data.event(); @@ -158,6 +147,8 @@ void serialize_key( } + + } // namespace fastcdr } // namespace eprosima diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h similarity index 92% rename from ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryPubSubTypes.h rename to ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h index 4f0b8130..3cb1f284 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include +#include "LogEntry.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,17 +38,6 @@ #endif // GEN_API_VER - - - - - - - - - - - /*! * @brief This class represents the TopicDataType of the type LogEntry defined by the user in the IDL file. * @ingroup LogEntry @@ -99,6 +88,9 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -114,7 +106,7 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -138,3 +130,4 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType }; #endif // _FAST_DDS_GENERATED_LOGENTRY_PUBSUBTYPES_H_ + diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp new file mode 100644 index 00000000..be3ea739 --- /dev/null +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp @@ -0,0 +1,54 @@ +// 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 LogEntryTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_LogEntry_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register LogEntry related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_LogEntry_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntry.h b/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntry.h deleted file mode 100644 index d8e458bf..00000000 --- a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntry.h +++ /dev/null @@ -1,332 +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 LogEntry.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_LOGENTRY_H_ -#define _FAST_DDS_GENERATED_LOGENTRY_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(LOGENTRY_SOURCE) -#define LOGENTRY_DllAPI __declspec( dllexport ) -#else -#define LOGENTRY_DllAPI __declspec( dllimport ) -#endif // LOGENTRY_SOURCE -#else -#define LOGENTRY_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define LOGENTRY_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - -const int32_t UNDEFINED = 0x10000000; - -const int32_t SAMPLE_LOST = 0x10000001; - -const int32_t TOPIC_MISMATCH_TYPE = 0x10000002; - -const int32_t TOPIC_MISMATCH_QOS = 0x10000003; - -/*! - * @brief This class represents the enumeration Kind defined by the user in the IDL file. - * @ingroup LogEntry - */ -enum Kind : uint32_t -{ - Info, - Warning, - Error -}; - - -/*! - * @brief This class represents the structure LogEntry defined by the user in the IDL file. - * @ingroup LogEntry - */ -class LogEntry -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport LogEntry(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~LogEntry(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry( - const LogEntry& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry( - LogEntry&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry& operator =( - const LogEntry& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry& operator =( - LogEntry&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x LogEntry object to compare. - */ - eProsima_user_DllExport bool operator ==( - const LogEntry& x) const; - - /*! - * @brief Comparison operator. - * @param x LogEntry object to compare. - */ - eProsima_user_DllExport bool operator !=( - const LogEntry& x) const; - - /*! - * @brief This function sets a value in member event - * @param _event New value for member event - */ - eProsima_user_DllExport void event( - int32_t _event); - - /*! - * @brief This function returns the value of member event - * @return Value of member event - */ - eProsima_user_DllExport int32_t event() const; - - /*! - * @brief This function returns a reference to member event - * @return Reference to member event - */ - eProsima_user_DllExport int32_t& event(); - - - /*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ - eProsima_user_DllExport void kind( - Kind _kind); - - /*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ - eProsima_user_DllExport Kind kind() const; - - /*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ - eProsima_user_DllExport Kind& kind(); - - - /*! - * @brief This function copies the value in member category - * @param _category New value to be copied in member category - */ - eProsima_user_DllExport void category( - const std::string& _category); - - /*! - * @brief This function moves the value in member category - * @param _category New value to be moved in member category - */ - eProsima_user_DllExport void category( - std::string&& _category); - - /*! - * @brief This function returns a constant reference to member category - * @return Constant reference to member category - */ - eProsima_user_DllExport const std::string& category() const; - - /*! - * @brief This function returns a reference to member category - * @return Reference to member category - */ - eProsima_user_DllExport std::string& category(); - - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::string& _message); - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::string&& _message); - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::string& message() const; - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::string& message(); - - - /*! - * @brief This function copies the value in member timestamp - * @param _timestamp New value to be copied in member timestamp - */ - eProsima_user_DllExport void timestamp( - const std::string& _timestamp); - - /*! - * @brief This function moves the value in member timestamp - * @param _timestamp New value to be moved in member timestamp - */ - eProsima_user_DllExport void timestamp( - std::string&& _timestamp); - - /*! - * @brief This function returns a constant reference to member timestamp - * @return Constant reference to member timestamp - */ - eProsima_user_DllExport const std::string& timestamp() const; - - /*! - * @brief This function returns a reference to member timestamp - * @return Reference to member timestamp - */ - eProsima_user_DllExport std::string& timestamp(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const LogEntry& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - int32_t m_event; - Kind m_kind; - std::string m_category; - std::string m_message; - std::string m_timestamp; - -}; - - -#endif // _FAST_DDS_GENERATED_LOGENTRY_H_ - - - diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryCdrAux.ipp deleted file mode 100644 index f7f8a6b4..00000000 --- a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryCdrAux.ipp +++ /dev/null @@ -1,165 +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 LogEntryCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_LOGENTRYCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_LOGENTRYCDRAUX_IPP_ - -#include "LogEntryCdrAux.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 LogEntry& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.event(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.kind(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.category(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), - data.message(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), - data.timestamp(), 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 LogEntry& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.event() - << eprosima::fastcdr::MemberId(1) << data.kind() - << eprosima::fastcdr::MemberId(2) << data.category() - << eprosima::fastcdr::MemberId(3) << data.message() - << eprosima::fastcdr::MemberId(4) << data.timestamp() - ; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - LogEntry& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.event(); - break; - - case 1: - dcdr >> data.kind(); - break; - - case 2: - dcdr >> data.category(); - break; - - case 3: - dcdr >> data.message(); - break; - - case 4: - dcdr >> data.timestamp(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const LogEntry& data) -{ - static_cast(scdr); - static_cast(data); - scdr << data.event(); - - - - - -} - -} // namespace fastcdr -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_LOGENTRYCDRAUX_IPP_ - diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryPubSubTypes.h deleted file mode 100644 index 4b61e892..00000000 --- a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryPubSubTypes.h +++ /dev/null @@ -1,140 +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 LogEntryPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef _FAST_DDS_GENERATED_LOGENTRY_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_LOGENTRY_PUBSUBTYPES_H_ - -#include -#include -#include -#include -#include - -#include - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated LogEntry is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - - - - - - - - - - - - -/*! - * @brief This class represents the TopicDataType of the type LogEntry defined by the user in the IDL file. - * @ingroup LogEntry - */ -class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef LogEntry type; - - eProsima_user_DllExport LogEntryPubSubType(); - - eProsima_user_DllExport ~LogEntryPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // _FAST_DDS_GENERATED_LOGENTRY_PUBSUBTYPES_H_ diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryTypeObject.h b/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryTypeObject.h deleted file mode 100644 index 57b79909..00000000 --- a/ddspipe_core/include/ddspipe_core/types/logging/v1/LogEntryTypeObject.h +++ /dev/null @@ -1,82 +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 LogEntryTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(LogEntry_SOURCE) -#define LogEntry_DllAPI __declspec( dllexport ) -#else -#define LogEntry_DllAPI __declspec( dllimport ) -#endif // LogEntry_SOURCE -#else -#define LogEntry_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define LogEntry_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerLogEntryTypes(); - - - - - - - - - -eProsima_user_DllExport const TypeIdentifier* GetKindIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetKindObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalKindObject(); -eProsima_user_DllExport const TypeObject* GetCompleteKindObject(); - - - -eProsima_user_DllExport const TypeIdentifier* GetLogEntryIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetLogEntryObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalLogEntryObject(); -eProsima_user_DllExport const TypeObject* GetCompleteLogEntryObject(); - - -#endif // _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryCdrAux.hpp deleted file mode 100644 index 1bf441e6..00000000 --- a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryCdrAux.hpp +++ /dev/null @@ -1,56 +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 LogEntryCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ - -#include - -constexpr uint32_t LogEntry_max_cdr_typesize {792UL}; -constexpr uint32_t LogEntry_max_key_cdr_typesize {4UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - - - - - - - - - - - - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const LogEntry& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryTypeObject.h b/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryTypeObject.h deleted file mode 100644 index 57b79909..00000000 --- a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryTypeObject.h +++ /dev/null @@ -1,82 +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 LogEntryTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(LogEntry_SOURCE) -#define LogEntry_DllAPI __declspec( dllexport ) -#else -#define LogEntry_DllAPI __declspec( dllimport ) -#endif // LogEntry_SOURCE -#else -#define LogEntry_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define LogEntry_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerLogEntryTypes(); - - - - - - - - - -eProsima_user_DllExport const TypeIdentifier* GetKindIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetKindObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalKindObject(); -eProsima_user_DllExport const TypeObject* GetCompleteKindObject(); - - - -eProsima_user_DllExport const TypeIdentifier* GetLogEntryIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetLogEntryObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalLogEntryObject(); -eProsima_user_DllExport const TypeObject* GetCompleteLogEntryObject(); - - -#endif // _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryv1.h b/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryv1.h deleted file mode 100644 index 6919f542..00000000 --- a/ddspipe_core/include/ddspipe_core/types/logging/v2/LogEntryv1.h +++ /dev/null @@ -1,337 +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 LogEntry.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_LOGENTRY_H_ -#define _FAST_DDS_GENERATED_LOGENTRY_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(LOGENTRY_SOURCE) -#define LOGENTRY_DllAPI __declspec( dllexport ) -#else -#define LOGENTRY_DllAPI __declspec( dllimport ) -#endif // LOGENTRY_SOURCE -#else -#define LOGENTRY_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define LOGENTRY_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - -const int32_t UNDEFINED = 0x10000000; - -const int32_t SAMPLE_LOST = 0x10000001; - -const int32_t TOPIC_MISMATCH_TYPE = 0x10000002; - -const int32_t TOPIC_MISMATCH_QOS = 0x10000003; - -/*! - * @brief This class represents the enumeration Kind defined by the user in the IDL file. - * @ingroup LogEntry - */ -enum Kind : uint32_t -{ - Info, - Warning, - Error -}; - - -/*! - * @brief This class represents the structure LogEntry defined by the user in the IDL file. - * @ingroup LogEntry - */ -class LogEntry -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport LogEntry(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~LogEntry(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry( - const LogEntry& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry( - LogEntry&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry& operator =( - const LogEntry& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object LogEntry that will be copied. - */ - eProsima_user_DllExport LogEntry& operator =( - LogEntry&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x LogEntry object to compare. - */ - eProsima_user_DllExport bool operator ==( - const LogEntry& x) const; - - /*! - * @brief Comparison operator. - * @param x LogEntry object to compare. - */ - eProsima_user_DllExport bool operator !=( - const LogEntry& x) const; - - /*! - * @brief This function sets a value in member event - * @param _event New value for member event - */ - eProsima_user_DllExport void event( - int32_t _event); - - /*! - * @brief This function returns the value of member event - * @return Value of member event - */ - eProsima_user_DllExport int32_t event() const; - - /*! - * @brief This function returns a reference to member event - * @return Reference to member event - */ - eProsima_user_DllExport int32_t& event(); - - - /*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ - eProsima_user_DllExport void kind( - Kind _kind); - - /*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ - eProsima_user_DllExport Kind kind() const; - - /*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ - eProsima_user_DllExport Kind& kind(); - - - /*! - * @brief This function copies the value in member category - * @param _category New value to be copied in member category - */ - eProsima_user_DllExport void category( - const std::string& _category); - - /*! - * @brief This function moves the value in member category - * @param _category New value to be moved in member category - */ - eProsima_user_DllExport void category( - std::string&& _category); - - /*! - * @brief This function returns a constant reference to member category - * @return Constant reference to member category - */ - eProsima_user_DllExport const std::string& category() const; - - /*! - * @brief This function returns a reference to member category - * @return Reference to member category - */ - eProsima_user_DllExport std::string& category(); - - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::string& _message); - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::string&& _message); - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::string& message() const; - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::string& message(); - - - /*! - * @brief This function copies the value in member timestamp - * @param _timestamp New value to be copied in member timestamp - */ - eProsima_user_DllExport void timestamp( - const std::string& _timestamp); - - /*! - * @brief This function moves the value in member timestamp - * @param _timestamp New value to be moved in member timestamp - */ - eProsima_user_DllExport void timestamp( - std::string&& _timestamp); - - /*! - * @brief This function returns a constant reference to member timestamp - * @return Constant reference to member timestamp - */ - eProsima_user_DllExport const std::string& timestamp() const; - - /*! - * @brief This function returns a reference to member timestamp - * @return Reference to member timestamp - */ - eProsima_user_DllExport std::string& timestamp(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const LogEntry& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - int32_t m_event; - Kind m_kind; - std::string m_category; - std::string m_message; - std::string m_timestamp; - -}; - - -#endif // _FAST_DDS_GENERATED_LOGENTRY_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatus.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatus.hpp similarity index 65% rename from ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatus.h rename to ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatus.hpp index b83b01ec..a39cb6ab 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatus.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatus.hpp @@ -13,32 +13,17 @@ // limitations under the License. /*! - * @file MonitoringStatus.h + * @file MonitoringStatus.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "MonitoringStatusv1.h" +#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_HPP_ +#define _FAST_DDS_GENERATED_MONITORINGSTATUS_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ - -#include -#include #include -#include -#include -#include - -#include -#include -#include - - +#include #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +49,6 @@ #define MONITORINGSTATUS_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure MonitoringErrorStatus defined by the user in the IDL file. * @ingroup MonitoringStatus @@ -86,73 +60,117 @@ class MonitoringErrorStatus /*! * @brief Default constructor. */ - eProsima_user_DllExport MonitoringErrorStatus(); + eProsima_user_DllExport MonitoringErrorStatus() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~MonitoringErrorStatus(); + eProsima_user_DllExport ~MonitoringErrorStatus() + { + } /*! * @brief Copy constructor. * @param x Reference to the object MonitoringErrorStatus that will be copied. */ eProsima_user_DllExport MonitoringErrorStatus( - const MonitoringErrorStatus& x); + const MonitoringErrorStatus& x) + { + m_type_mismatch = x.m_type_mismatch; + + m_qos_mismatch = x.m_qos_mismatch; + + } /*! * @brief Move constructor. * @param x Reference to the object MonitoringErrorStatus that will be copied. */ eProsima_user_DllExport MonitoringErrorStatus( - MonitoringErrorStatus&& x) noexcept; + MonitoringErrorStatus&& x) noexcept + { + m_type_mismatch = x.m_type_mismatch; + m_qos_mismatch = x.m_qos_mismatch; + } /*! * @brief Copy assignment. * @param x Reference to the object MonitoringErrorStatus that will be copied. */ eProsima_user_DllExport MonitoringErrorStatus& operator =( - const MonitoringErrorStatus& x); + const MonitoringErrorStatus& x) + { + + m_type_mismatch = x.m_type_mismatch; + + m_qos_mismatch = x.m_qos_mismatch; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object MonitoringErrorStatus that will be copied. */ eProsima_user_DllExport MonitoringErrorStatus& operator =( - MonitoringErrorStatus&& x) noexcept; + MonitoringErrorStatus&& x) noexcept + { + + m_type_mismatch = x.m_type_mismatch; + m_qos_mismatch = x.m_qos_mismatch; + return *this; + } /*! * @brief Comparison operator. * @param x MonitoringErrorStatus object to compare. */ eProsima_user_DllExport bool operator ==( - const MonitoringErrorStatus& x) const; + const MonitoringErrorStatus& x) const + { + return (m_type_mismatch == x.m_type_mismatch && + m_qos_mismatch == x.m_qos_mismatch); + } /*! * @brief Comparison operator. * @param x MonitoringErrorStatus object to compare. */ eProsima_user_DllExport bool operator !=( - const MonitoringErrorStatus& x) const; + const MonitoringErrorStatus& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member type_mismatch * @param _type_mismatch New value for member type_mismatch */ eProsima_user_DllExport void type_mismatch( - bool _type_mismatch); + bool _type_mismatch) + { + m_type_mismatch = _type_mismatch; + } /*! * @brief This function returns the value of member type_mismatch * @return Value of member type_mismatch */ - eProsima_user_DllExport bool type_mismatch() const; + eProsima_user_DllExport bool type_mismatch() const + { + return m_type_mismatch; + } /*! * @brief This function returns a reference to member type_mismatch * @return Reference to member type_mismatch */ - eProsima_user_DllExport bool& type_mismatch(); + eProsima_user_DllExport bool& type_mismatch() + { + return m_type_mismatch; + } /*! @@ -160,19 +178,30 @@ class MonitoringErrorStatus * @param _qos_mismatch New value for member qos_mismatch */ eProsima_user_DllExport void qos_mismatch( - bool _qos_mismatch); + bool _qos_mismatch) + { + m_qos_mismatch = _qos_mismatch; + } /*! * @brief This function returns the value of member qos_mismatch * @return Value of member qos_mismatch */ - eProsima_user_DllExport bool qos_mismatch() const; + eProsima_user_DllExport bool qos_mismatch() const + { + return m_qos_mismatch; + } /*! * @brief This function returns a reference to member qos_mismatch * @return Reference to member qos_mismatch */ - eProsima_user_DllExport bool& qos_mismatch(); + eProsima_user_DllExport bool& qos_mismatch() + { + return m_qos_mismatch; + } + + private: @@ -180,8 +209,6 @@ class MonitoringErrorStatus bool m_qos_mismatch{false}; }; - - /*! * @brief This class represents the structure MonitoringStatus defined by the user in the IDL file. * @ingroup MonitoringStatus @@ -193,80 +220,127 @@ class MonitoringStatus /*! * @brief Default constructor. */ - eProsima_user_DllExport MonitoringStatus(); + eProsima_user_DllExport MonitoringStatus() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~MonitoringStatus(); + eProsima_user_DllExport ~MonitoringStatus() + { + } /*! * @brief Copy constructor. * @param x Reference to the object MonitoringStatus that will be copied. */ eProsima_user_DllExport MonitoringStatus( - const MonitoringStatus& x); + const MonitoringStatus& x) + { + m_error_status = x.m_error_status; + + m_has_errors = x.m_has_errors; + + } /*! * @brief Move constructor. * @param x Reference to the object MonitoringStatus that will be copied. */ eProsima_user_DllExport MonitoringStatus( - MonitoringStatus&& x) noexcept; + MonitoringStatus&& x) noexcept + { + m_error_status = std::move(x.m_error_status); + m_has_errors = x.m_has_errors; + } /*! * @brief Copy assignment. * @param x Reference to the object MonitoringStatus that will be copied. */ eProsima_user_DllExport MonitoringStatus& operator =( - const MonitoringStatus& x); + const MonitoringStatus& x) + { + + m_error_status = x.m_error_status; + + m_has_errors = x.m_has_errors; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object MonitoringStatus that will be copied. */ eProsima_user_DllExport MonitoringStatus& operator =( - MonitoringStatus&& x) noexcept; + MonitoringStatus&& x) noexcept + { + + m_error_status = std::move(x.m_error_status); + m_has_errors = x.m_has_errors; + return *this; + } /*! * @brief Comparison operator. * @param x MonitoringStatus object to compare. */ eProsima_user_DllExport bool operator ==( - const MonitoringStatus& x) const; + const MonitoringStatus& x) const + { + return (m_error_status == x.m_error_status && + m_has_errors == x.m_has_errors); + } /*! * @brief Comparison operator. * @param x MonitoringStatus object to compare. */ eProsima_user_DllExport bool operator !=( - const MonitoringStatus& x) const; + const MonitoringStatus& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member error_status * @param _error_status New value to be copied in member error_status */ eProsima_user_DllExport void error_status( - const MonitoringErrorStatus& _error_status); + const MonitoringErrorStatus& _error_status) + { + m_error_status = _error_status; + } /*! * @brief This function moves the value in member error_status * @param _error_status New value to be moved in member error_status */ eProsima_user_DllExport void error_status( - MonitoringErrorStatus&& _error_status); + MonitoringErrorStatus&& _error_status) + { + m_error_status = std::move(_error_status); + } /*! * @brief This function returns a constant reference to member error_status * @return Constant reference to member error_status */ - eProsima_user_DllExport const MonitoringErrorStatus& error_status() const; + eProsima_user_DllExport const MonitoringErrorStatus& error_status() const + { + return m_error_status; + } /*! * @brief This function returns a reference to member error_status * @return Reference to member error_status */ - eProsima_user_DllExport MonitoringErrorStatus& error_status(); + eProsima_user_DllExport MonitoringErrorStatus& error_status() + { + return m_error_status; + } /*! @@ -274,19 +348,30 @@ class MonitoringStatus * @param _has_errors New value for member has_errors */ eProsima_user_DllExport void has_errors( - bool _has_errors); + bool _has_errors) + { + m_has_errors = _has_errors; + } /*! * @brief This function returns the value of member has_errors * @return Value of member has_errors */ - eProsima_user_DllExport bool has_errors() const; + eProsima_user_DllExport bool has_errors() const + { + return m_has_errors; + } /*! * @brief This function returns a reference to member has_errors * @return Reference to member has_errors */ - eProsima_user_DllExport bool& has_errors(); + eProsima_user_DllExport bool& has_errors() + { + return m_has_errors; + } + + private: @@ -295,8 +380,6 @@ class MonitoringStatus }; -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ - +#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.hpp similarity index 95% rename from ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusCdrAux.hpp rename to ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.hpp index 569809f1..7293b9d0 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusCdrAux.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ #define _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ -#include +#include "MonitoringStatus.hpp" constexpr uint32_t MonitoringErrorStatus_max_cdr_typesize {6UL}; constexpr uint32_t MonitoringErrorStatus_max_key_cdr_typesize {0UL}; @@ -37,14 +37,10 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const MonitoringErrorStatus& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const MonitoringStatus& data); @@ -54,3 +50,4 @@ eProsima_user_DllExport void serialize_key( } // namespace eprosima #endif // _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ + diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp similarity index 81% rename from ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusCdrAux.ipp rename to ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp index 897ab6ca..01e01b1f 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ #define _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ -#include +#include "MonitoringStatusCdrAux.hpp" #include #include @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -52,11 +50,11 @@ eProsima_user_DllExport size_t calculate_serialized_size( current_alignment)}; - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.type_mismatch(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.type_mismatch(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.qos_mismatch(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.qos_mismatch(), current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); @@ -78,7 +76,7 @@ eProsima_user_DllExport void serialize( scdr << eprosima::fastcdr::MemberId(0) << data.type_mismatch() << eprosima::fastcdr::MemberId(1) << data.qos_mismatch() - ; +; scdr.end_serialize_type(current_state); } @@ -95,13 +93,13 @@ eProsima_user_DllExport void deserialize( bool ret_value = true; switch (mid.id) { - case 0: - dcdr >> data.type_mismatch(); - break; + case 0: + dcdr >> data.type_mismatch(); + break; - case 1: - dcdr >> data.qos_mismatch(); - break; + case 1: + dcdr >> data.qos_mismatch(); + break; default: ret_value = false; @@ -119,6 +117,7 @@ void serialize_key( static_cast(data); } + template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -135,11 +134,11 @@ eProsima_user_DllExport size_t calculate_serialized_size( current_alignment)}; - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.error_status(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.error_status(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.has_errors(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.has_errors(), current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); @@ -161,7 +160,7 @@ eProsima_user_DllExport void serialize( scdr << eprosima::fastcdr::MemberId(0) << data.error_status() << eprosima::fastcdr::MemberId(1) << data.has_errors() - ; +; scdr.end_serialize_type(current_state); } @@ -178,13 +177,13 @@ eProsima_user_DllExport void deserialize( bool ret_value = true; switch (mid.id) { - case 0: - dcdr >> data.error_status(); - break; + case 0: + dcdr >> data.error_status(); + break; - case 1: - dcdr >> data.has_errors(); - break; + case 1: + dcdr >> data.has_errors(); + break; default: ret_value = false; @@ -202,7 +201,10 @@ void serialize_key( static_cast(data); } + + } // namespace fastcdr } // namespace eprosima #endif // _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ + diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h similarity index 92% rename from ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusPubSubTypes.h rename to ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h index cfe9df31..2bd9088f 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include +#include "MonitoringStatus.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type MonitoringErrorStatus defined by the user in the IDL file. * @ingroup MonitoringStatus @@ -90,6 +88,9 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -105,7 +106,7 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -128,8 +129,6 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData }; - - /*! * @brief This class represents the TopicDataType of the type MonitoringStatus defined by the user in the IDL file. * @ingroup MonitoringStatus @@ -180,6 +179,9 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -195,7 +197,7 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -219,3 +221,4 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType }; #endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_PUBSUBTYPES_H_ + diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp new file mode 100644 index 00000000..2207c3e2 --- /dev/null +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp @@ -0,0 +1,61 @@ +// 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 MonitoringStatusTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_MonitoringStatus_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register MonitoringErrorStatus related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_MonitoringErrorStatus_type_identifier(); +/** + * @brief Register MonitoringStatus related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_MonitoringStatus_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatus.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatus.h deleted file mode 100644 index 6b174087..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatus.h +++ /dev/null @@ -1,396 +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 MonitoringStatus.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MONITORINGSTATUS_SOURCE) -#define MONITORINGSTATUS_DllAPI __declspec( dllexport ) -#else -#define MONITORINGSTATUS_DllAPI __declspec( dllimport ) -#endif // MONITORINGSTATUS_SOURCE -#else -#define MONITORINGSTATUS_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MONITORINGSTATUS_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure MonitoringErrorStatus defined by the user in the IDL file. - * @ingroup MonitoringStatus - */ -class MonitoringErrorStatus -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitoringErrorStatus(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitoringErrorStatus(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus( - const MonitoringErrorStatus& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus( - MonitoringErrorStatus&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus& operator =( - const MonitoringErrorStatus& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus& operator =( - MonitoringErrorStatus&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MonitoringErrorStatus object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitoringErrorStatus& x) const; - - /*! - * @brief Comparison operator. - * @param x MonitoringErrorStatus object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitoringErrorStatus& x) const; - - /*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ - eProsima_user_DllExport void type_mismatch( - bool _type_mismatch); - - /*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ - eProsima_user_DllExport bool type_mismatch() const; - - /*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ - eProsima_user_DllExport bool& type_mismatch(); - - - /*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ - eProsima_user_DllExport void qos_mismatch( - bool _qos_mismatch); - - /*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ - eProsima_user_DllExport bool qos_mismatch() const; - - /*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ - eProsima_user_DllExport bool& qos_mismatch(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MonitoringErrorStatus& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - bool m_type_mismatch; - bool m_qos_mismatch; - -}; - - - -/*! - * @brief This class represents the structure MonitoringStatus defined by the user in the IDL file. - * @ingroup MonitoringStatus - */ -class MonitoringStatus -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitoringStatus(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitoringStatus(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus( - const MonitoringStatus& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus( - MonitoringStatus&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus& operator =( - const MonitoringStatus& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus& operator =( - MonitoringStatus&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MonitoringStatus object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitoringStatus& x) const; - - /*! - * @brief Comparison operator. - * @param x MonitoringStatus object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitoringStatus& x) const; - - /*! - * @brief This function copies the value in member error_status - * @param _error_status New value to be copied in member error_status - */ - eProsima_user_DllExport void error_status( - const MonitoringErrorStatus& _error_status); - - /*! - * @brief This function moves the value in member error_status - * @param _error_status New value to be moved in member error_status - */ - eProsima_user_DllExport void error_status( - MonitoringErrorStatus&& _error_status); - - /*! - * @brief This function returns a constant reference to member error_status - * @return Constant reference to member error_status - */ - eProsima_user_DllExport const MonitoringErrorStatus& error_status() const; - - /*! - * @brief This function returns a reference to member error_status - * @return Reference to member error_status - */ - eProsima_user_DllExport MonitoringErrorStatus& error_status(); - - - /*! - * @brief This function sets a value in member has_errors - * @param _has_errors New value for member has_errors - */ - eProsima_user_DllExport void has_errors( - bool _has_errors); - - /*! - * @brief This function returns the value of member has_errors - * @return Value of member has_errors - */ - eProsima_user_DllExport bool has_errors() const; - - /*! - * @brief This function returns a reference to member has_errors - * @return Reference to member has_errors - */ - eProsima_user_DllExport bool& has_errors(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MonitoringStatus& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - MonitoringErrorStatus m_error_status; - bool m_has_errors; - -}; - - -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ - - - diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusCdrAux.ipp deleted file mode 100644 index b21edd4a..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusCdrAux.ipp +++ /dev/null @@ -1,208 +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 MonitoringStatusCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ - -#include - -#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 MonitoringErrorStatus& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.type_mismatch(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.qos_mismatch(), 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 MonitoringErrorStatus& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.type_mismatch() - << eprosima::fastcdr::MemberId(1) << data.qos_mismatch() - ; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - MonitoringErrorStatus& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.type_mismatch(); - break; - - case 1: - dcdr >> data.qos_mismatch(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const MonitoringErrorStatus& data) -{ - static_cast(scdr); - static_cast(data); -} - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const MonitoringStatus& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.error_status(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.has_errors(), 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 MonitoringStatus& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.error_status() - << eprosima::fastcdr::MemberId(1) << data.has_errors() - ; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - MonitoringStatus& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.error_status(); - break; - - case 1: - dcdr >> data.has_errors(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const MonitoringStatus& data) -{ - static_cast(scdr); - static_cast(data); -} - -} // namespace fastcdr -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusPubSubTypes.h deleted file mode 100644 index 8d3c7fdd..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusPubSubTypes.h +++ /dev/null @@ -1,221 +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 MonitoringStatusPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_PUBSUBTYPES_H_ - -#include -#include -#include -#include -#include - -#include - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated MonitoringStatus is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - - - -/*! - * @brief This class represents the TopicDataType of the type MonitoringErrorStatus defined by the user in the IDL file. - * @ingroup MonitoringStatus - */ -class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef MonitoringErrorStatus type; - - eProsima_user_DllExport MonitoringErrorStatusPubSubType(); - - eProsima_user_DllExport ~MonitoringErrorStatusPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - - - -/*! - * @brief This class represents the TopicDataType of the type MonitoringStatus defined by the user in the IDL file. - * @ingroup MonitoringStatus - */ -class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef MonitoringStatus type; - - eProsima_user_DllExport MonitoringStatusPubSubType(); - - eProsima_user_DllExport ~MonitoringStatusPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_PUBSUBTYPES_H_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusTypeObject.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusTypeObject.h deleted file mode 100644 index 5d5795aa..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v1/MonitoringStatusTypeObject.h +++ /dev/null @@ -1,76 +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 MonitoringStatusTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MonitoringStatus_SOURCE) -#define MonitoringStatus_DllAPI __declspec( dllexport ) -#else -#define MonitoringStatus_DllAPI __declspec( dllimport ) -#endif // MonitoringStatus_SOURCE -#else -#define MonitoringStatus_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define MonitoringStatus_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerMonitoringStatusTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetMonitoringErrorStatusIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMonitoringErrorStatusObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMonitoringErrorStatusObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMonitoringErrorStatusObject(); - - - -eProsima_user_DllExport const TypeIdentifier* GetMonitoringStatusIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMonitoringStatusObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMonitoringStatusObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMonitoringStatusObject(); - - -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusCdrAux.hpp deleted file mode 100644 index 67bc022a..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusCdrAux.hpp +++ /dev/null @@ -1,56 +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 MonitoringStatusCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ - -#include - -constexpr uint32_t MonitoringErrorStatus_max_cdr_typesize {6UL}; -constexpr uint32_t MonitoringErrorStatus_max_key_cdr_typesize {0UL}; - -constexpr uint32_t MonitoringStatus_max_cdr_typesize {11UL}; -constexpr uint32_t MonitoringStatus_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - - - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const MonitoringErrorStatus& data); - - - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const MonitoringStatus& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusTypeObject.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusTypeObject.h deleted file mode 100644 index 5d5795aa..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusTypeObject.h +++ /dev/null @@ -1,76 +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 MonitoringStatusTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MonitoringStatus_SOURCE) -#define MonitoringStatus_DllAPI __declspec( dllexport ) -#else -#define MonitoringStatus_DllAPI __declspec( dllimport ) -#endif // MonitoringStatus_SOURCE -#else -#define MonitoringStatus_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define MonitoringStatus_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerMonitoringStatusTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetMonitoringErrorStatusIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMonitoringErrorStatusObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMonitoringErrorStatusObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMonitoringErrorStatusObject(); - - - -eProsima_user_DllExport const TypeIdentifier* GetMonitoringStatusIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMonitoringStatusObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMonitoringStatusObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMonitoringStatusObject(); - - -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusv1.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusv1.h deleted file mode 100644 index fcf2bd97..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/v2/MonitoringStatusv1.h +++ /dev/null @@ -1,401 +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 MonitoringStatus.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MONITORINGSTATUS_SOURCE) -#define MONITORINGSTATUS_DllAPI __declspec( dllexport ) -#else -#define MONITORINGSTATUS_DllAPI __declspec( dllimport ) -#endif // MONITORINGSTATUS_SOURCE -#else -#define MONITORINGSTATUS_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MONITORINGSTATUS_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure MonitoringErrorStatus defined by the user in the IDL file. - * @ingroup MonitoringStatus - */ -class MonitoringErrorStatus -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitoringErrorStatus(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitoringErrorStatus(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus( - const MonitoringErrorStatus& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus( - MonitoringErrorStatus&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus& operator =( - const MonitoringErrorStatus& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MonitoringErrorStatus that will be copied. - */ - eProsima_user_DllExport MonitoringErrorStatus& operator =( - MonitoringErrorStatus&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MonitoringErrorStatus object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitoringErrorStatus& x) const; - - /*! - * @brief Comparison operator. - * @param x MonitoringErrorStatus object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitoringErrorStatus& x) const; - - /*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ - eProsima_user_DllExport void type_mismatch( - bool _type_mismatch); - - /*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ - eProsima_user_DllExport bool type_mismatch() const; - - /*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ - eProsima_user_DllExport bool& type_mismatch(); - - - /*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ - eProsima_user_DllExport void qos_mismatch( - bool _qos_mismatch); - - /*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ - eProsima_user_DllExport bool qos_mismatch() const; - - /*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ - eProsima_user_DllExport bool& qos_mismatch(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MonitoringErrorStatus& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - bool m_type_mismatch; - bool m_qos_mismatch; - -}; - - - -/*! - * @brief This class represents the structure MonitoringStatus defined by the user in the IDL file. - * @ingroup MonitoringStatus - */ -class MonitoringStatus -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitoringStatus(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitoringStatus(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus( - const MonitoringStatus& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus( - MonitoringStatus&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus& operator =( - const MonitoringStatus& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MonitoringStatus that will be copied. - */ - eProsima_user_DllExport MonitoringStatus& operator =( - MonitoringStatus&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MonitoringStatus object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitoringStatus& x) const; - - /*! - * @brief Comparison operator. - * @param x MonitoringStatus object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitoringStatus& x) const; - - /*! - * @brief This function copies the value in member error_status - * @param _error_status New value to be copied in member error_status - */ - eProsima_user_DllExport void error_status( - const MonitoringErrorStatus& _error_status); - - /*! - * @brief This function moves the value in member error_status - * @param _error_status New value to be moved in member error_status - */ - eProsima_user_DllExport void error_status( - MonitoringErrorStatus&& _error_status); - - /*! - * @brief This function returns a constant reference to member error_status - * @return Constant reference to member error_status - */ - eProsima_user_DllExport const MonitoringErrorStatus& error_status() const; - - /*! - * @brief This function returns a reference to member error_status - * @return Reference to member error_status - */ - eProsima_user_DllExport MonitoringErrorStatus& error_status(); - - - /*! - * @brief This function sets a value in member has_errors - * @param _has_errors New value for member has_errors - */ - eProsima_user_DllExport void has_errors( - bool _has_errors); - - /*! - * @brief This function returns the value of member has_errors - * @return Value of member has_errors - */ - eProsima_user_DllExport bool has_errors() const; - - /*! - * @brief This function returns a reference to member has_errors - * @return Reference to member has_errors - */ - eProsima_user_DllExport bool& has_errors(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MonitoringStatus& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - MonitoringErrorStatus m_error_status; - bool m_has_errors; - -}; - - -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopics.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopics.hpp similarity index 60% rename from ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopics.h rename to ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopics.hpp index d5cb1b07..ecae6507 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopics.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopics.hpp @@ -13,32 +13,21 @@ // limitations under the License. /*! - * @file MonitoringTopics.h + * @file MonitoringTopics.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "MonitoringTopicsv1.h" +#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_HPP_ +#define _FAST_DDS_GENERATED_MONITORINGTOPICS_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ - -#include -#include #include -#include #include +#include #include #include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +53,6 @@ #define MONITORINGTOPICS_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure DdsTopicData defined by the user in the IDL file. * @ingroup MonitoringTopics @@ -86,80 +64,141 @@ class DdsTopicData /*! * @brief Default constructor. */ - eProsima_user_DllExport DdsTopicData(); + eProsima_user_DllExport DdsTopicData() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~DdsTopicData(); + eProsima_user_DllExport ~DdsTopicData() + { + } /*! * @brief Copy constructor. * @param x Reference to the object DdsTopicData that will be copied. */ eProsima_user_DllExport DdsTopicData( - const DdsTopicData& x); + const DdsTopicData& x) + { + m_participant_id = x.m_participant_id; + + m_msgs_lost = x.m_msgs_lost; + + m_msgs_received = x.m_msgs_received; + + m_msg_rx_rate = x.m_msg_rx_rate; + + } /*! * @brief Move constructor. * @param x Reference to the object DdsTopicData that will be copied. */ eProsima_user_DllExport DdsTopicData( - DdsTopicData&& x) noexcept; + DdsTopicData&& x) noexcept + { + m_participant_id = std::move(x.m_participant_id); + m_msgs_lost = x.m_msgs_lost; + m_msgs_received = x.m_msgs_received; + m_msg_rx_rate = x.m_msg_rx_rate; + } /*! * @brief Copy assignment. * @param x Reference to the object DdsTopicData that will be copied. */ eProsima_user_DllExport DdsTopicData& operator =( - const DdsTopicData& x); + const DdsTopicData& x) + { + + m_participant_id = x.m_participant_id; + + m_msgs_lost = x.m_msgs_lost; + + m_msgs_received = x.m_msgs_received; + + m_msg_rx_rate = x.m_msg_rx_rate; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object DdsTopicData that will be copied. */ eProsima_user_DllExport DdsTopicData& operator =( - DdsTopicData&& x) noexcept; + DdsTopicData&& x) noexcept + { + + m_participant_id = std::move(x.m_participant_id); + m_msgs_lost = x.m_msgs_lost; + m_msgs_received = x.m_msgs_received; + m_msg_rx_rate = x.m_msg_rx_rate; + return *this; + } /*! * @brief Comparison operator. * @param x DdsTopicData object to compare. */ eProsima_user_DllExport bool operator ==( - const DdsTopicData& x) const; + const DdsTopicData& x) const + { + return (m_participant_id == x.m_participant_id && + m_msgs_lost == x.m_msgs_lost && + m_msgs_received == x.m_msgs_received && + m_msg_rx_rate == x.m_msg_rx_rate); + } /*! * @brief Comparison operator. * @param x DdsTopicData object to compare. */ eProsima_user_DllExport bool operator !=( - const DdsTopicData& x) const; + const DdsTopicData& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member participant_id * @param _participant_id New value to be copied in member participant_id */ eProsima_user_DllExport void participant_id( - const std::string& _participant_id); + const std::string& _participant_id) + { + m_participant_id = _participant_id; + } /*! * @brief This function moves the value in member participant_id * @param _participant_id New value to be moved in member participant_id */ eProsima_user_DllExport void participant_id( - std::string&& _participant_id); + std::string&& _participant_id) + { + m_participant_id = std::move(_participant_id); + } /*! * @brief This function returns a constant reference to member participant_id * @return Constant reference to member participant_id */ - eProsima_user_DllExport const std::string& participant_id() const; + eProsima_user_DllExport const std::string& participant_id() const + { + return m_participant_id; + } /*! * @brief This function returns a reference to member participant_id * @return Reference to member participant_id */ - eProsima_user_DllExport std::string& participant_id(); + eProsima_user_DllExport std::string& participant_id() + { + return m_participant_id; + } /*! @@ -167,19 +206,28 @@ class DdsTopicData * @param _msgs_lost New value for member msgs_lost */ eProsima_user_DllExport void msgs_lost( - uint32_t _msgs_lost); + uint32_t _msgs_lost) + { + m_msgs_lost = _msgs_lost; + } /*! * @brief This function returns the value of member msgs_lost * @return Value of member msgs_lost */ - eProsima_user_DllExport uint32_t msgs_lost() const; + eProsima_user_DllExport uint32_t msgs_lost() const + { + return m_msgs_lost; + } /*! * @brief This function returns a reference to member msgs_lost * @return Reference to member msgs_lost */ - eProsima_user_DllExport uint32_t& msgs_lost(); + eProsima_user_DllExport uint32_t& msgs_lost() + { + return m_msgs_lost; + } /*! @@ -187,19 +235,28 @@ class DdsTopicData * @param _msgs_received New value for member msgs_received */ eProsima_user_DllExport void msgs_received( - uint32_t _msgs_received); + uint32_t _msgs_received) + { + m_msgs_received = _msgs_received; + } /*! * @brief This function returns the value of member msgs_received * @return Value of member msgs_received */ - eProsima_user_DllExport uint32_t msgs_received() const; + eProsima_user_DllExport uint32_t msgs_received() const + { + return m_msgs_received; + } /*! * @brief This function returns a reference to member msgs_received * @return Reference to member msgs_received */ - eProsima_user_DllExport uint32_t& msgs_received(); + eProsima_user_DllExport uint32_t& msgs_received() + { + return m_msgs_received; + } /*! @@ -207,19 +264,30 @@ class DdsTopicData * @param _msg_rx_rate New value for member msg_rx_rate */ eProsima_user_DllExport void msg_rx_rate( - double _msg_rx_rate); + double _msg_rx_rate) + { + m_msg_rx_rate = _msg_rx_rate; + } /*! * @brief This function returns the value of member msg_rx_rate * @return Value of member msg_rx_rate */ - eProsima_user_DllExport double msg_rx_rate() const; + eProsima_user_DllExport double msg_rx_rate() const + { + return m_msg_rx_rate; + } /*! * @brief This function returns a reference to member msg_rx_rate * @return Reference to member msg_rx_rate */ - eProsima_user_DllExport double& msg_rx_rate(); + eProsima_user_DllExport double& msg_rx_rate() + { + return m_msg_rx_rate; + } + + private: @@ -229,10 +297,6 @@ class DdsTopicData double m_msg_rx_rate{0.0}; }; - - - - /*! * @brief This class represents the structure DdsTopic defined by the user in the IDL file. * @ingroup MonitoringTopics @@ -244,80 +308,155 @@ class DdsTopic /*! * @brief Default constructor. */ - eProsima_user_DllExport DdsTopic(); + eProsima_user_DllExport DdsTopic() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~DdsTopic(); + eProsima_user_DllExport ~DdsTopic() + { + } /*! * @brief Copy constructor. * @param x Reference to the object DdsTopic that will be copied. */ eProsima_user_DllExport DdsTopic( - const DdsTopic& x); + const DdsTopic& x) + { + m_name = x.m_name; + + m_type_name = x.m_type_name; + + m_type_discovered = x.m_type_discovered; + + m_type_mismatch = x.m_type_mismatch; + + m_qos_mismatch = x.m_qos_mismatch; + + m_data = x.m_data; + + } /*! * @brief Move constructor. * @param x Reference to the object DdsTopic that will be copied. */ eProsima_user_DllExport DdsTopic( - DdsTopic&& x) noexcept; + DdsTopic&& x) noexcept + { + m_name = std::move(x.m_name); + m_type_name = std::move(x.m_type_name); + m_type_discovered = x.m_type_discovered; + m_type_mismatch = x.m_type_mismatch; + m_qos_mismatch = x.m_qos_mismatch; + m_data = std::move(x.m_data); + } /*! * @brief Copy assignment. * @param x Reference to the object DdsTopic that will be copied. */ eProsima_user_DllExport DdsTopic& operator =( - const DdsTopic& x); + const DdsTopic& x) + { + + m_name = x.m_name; + + m_type_name = x.m_type_name; + + m_type_discovered = x.m_type_discovered; + + m_type_mismatch = x.m_type_mismatch; + + m_qos_mismatch = x.m_qos_mismatch; + + m_data = x.m_data; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object DdsTopic that will be copied. */ eProsima_user_DllExport DdsTopic& operator =( - DdsTopic&& x) noexcept; + DdsTopic&& x) noexcept + { + + m_name = std::move(x.m_name); + m_type_name = std::move(x.m_type_name); + m_type_discovered = x.m_type_discovered; + m_type_mismatch = x.m_type_mismatch; + m_qos_mismatch = x.m_qos_mismatch; + m_data = std::move(x.m_data); + return *this; + } /*! * @brief Comparison operator. * @param x DdsTopic object to compare. */ eProsima_user_DllExport bool operator ==( - const DdsTopic& x) const; + const DdsTopic& x) const + { + return (m_name == x.m_name && + m_type_name == x.m_type_name && + m_type_discovered == x.m_type_discovered && + m_type_mismatch == x.m_type_mismatch && + m_qos_mismatch == x.m_qos_mismatch && + m_data == x.m_data); + } /*! * @brief Comparison operator. * @param x DdsTopic object to compare. */ eProsima_user_DllExport bool operator !=( - const DdsTopic& x) const; + const DdsTopic& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member name * @param _name New value to be copied in member name */ eProsima_user_DllExport void name( - const std::string& _name); + const std::string& _name) + { + m_name = _name; + } /*! * @brief This function moves the value in member name * @param _name New value to be moved in member name */ eProsima_user_DllExport void name( - std::string&& _name); + std::string&& _name) + { + m_name = std::move(_name); + } /*! * @brief This function returns a constant reference to member name * @return Constant reference to member name */ - eProsima_user_DllExport const std::string& name() const; + eProsima_user_DllExport const std::string& name() const + { + return m_name; + } /*! * @brief This function returns a reference to member name * @return Reference to member name */ - eProsima_user_DllExport std::string& name(); + eProsima_user_DllExport std::string& name() + { + return m_name; + } /*! @@ -325,26 +464,38 @@ class DdsTopic * @param _type_name New value to be copied in member type_name */ eProsima_user_DllExport void type_name( - const std::string& _type_name); + const std::string& _type_name) + { + m_type_name = _type_name; + } /*! * @brief This function moves the value in member type_name * @param _type_name New value to be moved in member type_name */ eProsima_user_DllExport void type_name( - std::string&& _type_name); + std::string&& _type_name) + { + m_type_name = std::move(_type_name); + } /*! * @brief This function returns a constant reference to member type_name * @return Constant reference to member type_name */ - eProsima_user_DllExport const std::string& type_name() const; + eProsima_user_DllExport const std::string& type_name() const + { + return m_type_name; + } /*! * @brief This function returns a reference to member type_name * @return Reference to member type_name */ - eProsima_user_DllExport std::string& type_name(); + eProsima_user_DllExport std::string& type_name() + { + return m_type_name; + } /*! @@ -352,19 +503,28 @@ class DdsTopic * @param _type_discovered New value for member type_discovered */ eProsima_user_DllExport void type_discovered( - bool _type_discovered); + bool _type_discovered) + { + m_type_discovered = _type_discovered; + } /*! * @brief This function returns the value of member type_discovered * @return Value of member type_discovered */ - eProsima_user_DllExport bool type_discovered() const; + eProsima_user_DllExport bool type_discovered() const + { + return m_type_discovered; + } /*! * @brief This function returns a reference to member type_discovered * @return Reference to member type_discovered */ - eProsima_user_DllExport bool& type_discovered(); + eProsima_user_DllExport bool& type_discovered() + { + return m_type_discovered; + } /*! @@ -372,19 +532,28 @@ class DdsTopic * @param _type_mismatch New value for member type_mismatch */ eProsima_user_DllExport void type_mismatch( - bool _type_mismatch); + bool _type_mismatch) + { + m_type_mismatch = _type_mismatch; + } /*! * @brief This function returns the value of member type_mismatch * @return Value of member type_mismatch */ - eProsima_user_DllExport bool type_mismatch() const; + eProsima_user_DllExport bool type_mismatch() const + { + return m_type_mismatch; + } /*! * @brief This function returns a reference to member type_mismatch * @return Reference to member type_mismatch */ - eProsima_user_DllExport bool& type_mismatch(); + eProsima_user_DllExport bool& type_mismatch() + { + return m_type_mismatch; + } /*! @@ -392,19 +561,28 @@ class DdsTopic * @param _qos_mismatch New value for member qos_mismatch */ eProsima_user_DllExport void qos_mismatch( - bool _qos_mismatch); + bool _qos_mismatch) + { + m_qos_mismatch = _qos_mismatch; + } /*! * @brief This function returns the value of member qos_mismatch * @return Value of member qos_mismatch */ - eProsima_user_DllExport bool qos_mismatch() const; + eProsima_user_DllExport bool qos_mismatch() const + { + return m_qos_mismatch; + } /*! * @brief This function returns a reference to member qos_mismatch * @return Reference to member qos_mismatch */ - eProsima_user_DllExport bool& qos_mismatch(); + eProsima_user_DllExport bool& qos_mismatch() + { + return m_qos_mismatch; + } /*! @@ -412,26 +590,40 @@ class DdsTopic * @param _data New value to be copied in member data */ eProsima_user_DllExport void data( - const std::vector& _data); + const std::vector& _data) + { + m_data = _data; + } /*! * @brief This function moves the value in member data * @param _data New value to be moved in member data */ eProsima_user_DllExport void data( - std::vector&& _data); + std::vector&& _data) + { + m_data = std::move(_data); + } /*! * @brief This function returns a constant reference to member data * @return Constant reference to member data */ - eProsima_user_DllExport const std::vector& data() const; + eProsima_user_DllExport const std::vector& data() const + { + return m_data; + } /*! * @brief This function returns a reference to member data * @return Reference to member data */ - eProsima_user_DllExport std::vector& data(); + eProsima_user_DllExport std::vector& data() + { + return m_data; + } + + private: @@ -443,10 +635,6 @@ class DdsTopic std::vector m_data; }; - - - - /*! * @brief This class represents the structure MonitoringTopics defined by the user in the IDL file. * @ingroup MonitoringTopics @@ -458,80 +646,122 @@ class MonitoringTopics /*! * @brief Default constructor. */ - eProsima_user_DllExport MonitoringTopics(); + eProsima_user_DllExport MonitoringTopics() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~MonitoringTopics(); + eProsima_user_DllExport ~MonitoringTopics() + { + } /*! * @brief Copy constructor. * @param x Reference to the object MonitoringTopics that will be copied. */ eProsima_user_DllExport MonitoringTopics( - const MonitoringTopics& x); + const MonitoringTopics& x) + { + m_topics = x.m_topics; + + } /*! * @brief Move constructor. * @param x Reference to the object MonitoringTopics that will be copied. */ eProsima_user_DllExport MonitoringTopics( - MonitoringTopics&& x) noexcept; + MonitoringTopics&& x) noexcept + { + m_topics = std::move(x.m_topics); + } /*! * @brief Copy assignment. * @param x Reference to the object MonitoringTopics that will be copied. */ eProsima_user_DllExport MonitoringTopics& operator =( - const MonitoringTopics& x); + const MonitoringTopics& x) + { + + m_topics = x.m_topics; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object MonitoringTopics that will be copied. */ eProsima_user_DllExport MonitoringTopics& operator =( - MonitoringTopics&& x) noexcept; + MonitoringTopics&& x) noexcept + { + + m_topics = std::move(x.m_topics); + return *this; + } /*! * @brief Comparison operator. * @param x MonitoringTopics object to compare. */ eProsima_user_DllExport bool operator ==( - const MonitoringTopics& x) const; + const MonitoringTopics& x) const + { + return (m_topics == x.m_topics); + } /*! * @brief Comparison operator. * @param x MonitoringTopics object to compare. */ eProsima_user_DllExport bool operator !=( - const MonitoringTopics& x) const; + const MonitoringTopics& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member topics * @param _topics New value to be copied in member topics */ eProsima_user_DllExport void topics( - const std::vector& _topics); + const std::vector& _topics) + { + m_topics = _topics; + } /*! * @brief This function moves the value in member topics * @param _topics New value to be moved in member topics */ eProsima_user_DllExport void topics( - std::vector&& _topics); + std::vector&& _topics) + { + m_topics = std::move(_topics); + } /*! * @brief This function returns a constant reference to member topics * @return Constant reference to member topics */ - eProsima_user_DllExport const std::vector& topics() const; + eProsima_user_DllExport const std::vector& topics() const + { + return m_topics; + } /*! * @brief This function returns a reference to member topics * @return Reference to member topics */ - eProsima_user_DllExport std::vector& topics(); + eProsima_user_DllExport std::vector& topics() + { + return m_topics; + } + + private: @@ -539,8 +769,6 @@ class MonitoringTopics }; -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ - +#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.hpp similarity index 89% rename from ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsCdrAux.hpp rename to ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.hpp index ca7db5ed..6f49032a 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsCdrAux.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.hpp @@ -22,15 +22,15 @@ #ifndef _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ #define _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ -#include +#include "MonitoringTopics.hpp" constexpr uint32_t DdsTopicData_max_cdr_typesize {280UL}; constexpr uint32_t DdsTopicData_max_key_cdr_typesize {0UL}; -constexpr uint32_t MonitoringTopics_max_cdr_typesize {2853616UL}; +constexpr uint32_t MonitoringTopics_max_cdr_typesize {12UL}; constexpr uint32_t MonitoringTopics_max_key_cdr_typesize {0UL}; -constexpr uint32_t DdsTopic_max_cdr_typesize {28536UL}; +constexpr uint32_t DdsTopic_max_cdr_typesize {536UL}; constexpr uint32_t DdsTopic_max_key_cdr_typesize {0UL}; @@ -40,24 +40,14 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const DdsTopicData& data); - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const DdsTopic& data); - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const MonitoringTopics& data); @@ -67,3 +57,4 @@ eProsima_user_DllExport void serialize_key( } // namespace eprosima #endif // _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ + diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp similarity index 70% rename from ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsCdrAux.ipp rename to ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp index 0ad02f8a..601b3db0 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -52,17 +50,17 @@ eProsima_user_DllExport size_t calculate_serialized_size( current_alignment)}; - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.participant_id(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.participant_id(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.msgs_lost(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.msgs_lost(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.msgs_received(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), + data.msgs_received(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), - data.msg_rx_rate(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), + data.msg_rx_rate(), current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); @@ -86,7 +84,7 @@ eProsima_user_DllExport void serialize( << eprosima::fastcdr::MemberId(1) << data.msgs_lost() << eprosima::fastcdr::MemberId(2) << data.msgs_received() << eprosima::fastcdr::MemberId(3) << data.msg_rx_rate() - ; +; scdr.end_serialize_type(current_state); } @@ -103,21 +101,21 @@ eProsima_user_DllExport void deserialize( bool ret_value = true; switch (mid.id) { - case 0: - dcdr >> data.participant_id(); - break; + case 0: + dcdr >> data.participant_id(); + break; - case 1: - dcdr >> data.msgs_lost(); - break; + case 1: + dcdr >> data.msgs_lost(); + break; - case 2: - dcdr >> data.msgs_received(); - break; + case 2: + dcdr >> data.msgs_received(); + break; - case 3: - dcdr >> data.msg_rx_rate(); - break; + case 3: + dcdr >> data.msg_rx_rate(); + break; default: ret_value = false; @@ -135,6 +133,7 @@ void serialize_key( static_cast(data); } + template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -151,23 +150,23 @@ eProsima_user_DllExport size_t calculate_serialized_size( current_alignment)}; - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.name(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.name(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.type_name(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.type_name(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.type_discovered(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), + data.type_discovered(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), - data.type_mismatch(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), + data.type_mismatch(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), - data.qos_mismatch(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), + data.qos_mismatch(), current_alignment); - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5), - data.data(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5), + data.data(), current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); @@ -193,7 +192,7 @@ eProsima_user_DllExport void serialize( << eprosima::fastcdr::MemberId(3) << data.type_mismatch() << eprosima::fastcdr::MemberId(4) << data.qos_mismatch() << eprosima::fastcdr::MemberId(5) << data.data() - ; +; scdr.end_serialize_type(current_state); } @@ -210,29 +209,29 @@ eProsima_user_DllExport void deserialize( bool ret_value = true; switch (mid.id) { - case 0: - dcdr >> data.name(); - break; + case 0: + dcdr >> data.name(); + break; - case 1: - dcdr >> data.type_name(); - break; + case 1: + dcdr >> data.type_name(); + break; - case 2: - dcdr >> data.type_discovered(); - break; + case 2: + dcdr >> data.type_discovered(); + break; - case 3: - dcdr >> data.type_mismatch(); - break; + case 3: + dcdr >> data.type_mismatch(); + break; - case 4: - dcdr >> data.qos_mismatch(); - break; + case 4: + dcdr >> data.qos_mismatch(); + break; - case 5: - dcdr >> data.data(); - break; + case 5: + dcdr >> data.data(); + break; default: ret_value = false; @@ -250,6 +249,7 @@ void serialize_key( static_cast(data); } + template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -266,8 +266,8 @@ eProsima_user_DllExport size_t calculate_serialized_size( current_alignment)}; - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.topics(), current_alignment); + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.topics(), current_alignment); calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); @@ -288,7 +288,7 @@ eProsima_user_DllExport void serialize( scdr << eprosima::fastcdr::MemberId(0) << data.topics() - ; +; scdr.end_serialize_type(current_state); } @@ -305,9 +305,9 @@ eProsima_user_DllExport void deserialize( bool ret_value = true; switch (mid.id) { - case 0: - dcdr >> data.topics(); - break; + case 0: + dcdr >> data.topics(); + break; default: ret_value = false; @@ -325,7 +325,10 @@ void serialize_key( static_cast(data); } + + } // namespace fastcdr } // namespace eprosima #endif // _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_IPP_ + diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h similarity index 91% rename from ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsPubSubTypes.h rename to ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h index a6c42429..8d9fd95a 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include +#include "MonitoringTopics.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type DdsTopicData defined by the user in the IDL file. * @ingroup MonitoringTopics @@ -90,6 +88,9 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -105,7 +106,7 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -128,10 +129,6 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType }; - - - - /*! * @brief This class represents the TopicDataType of the type DdsTopic defined by the user in the IDL file. * @ingroup MonitoringTopics @@ -182,6 +179,9 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -197,7 +197,7 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -220,10 +220,6 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType }; - - - - /*! * @brief This class represents the TopicDataType of the type MonitoringTopics defined by the user in the IDL file. * @ingroup MonitoringTopics @@ -274,6 +270,9 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -289,7 +288,7 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -313,3 +312,4 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType }; #endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_PUBSUBTYPES_H_ + diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp new file mode 100644 index 00000000..12817394 --- /dev/null +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp @@ -0,0 +1,68 @@ +// 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 MonitoringTopicsTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_MonitoringTopics_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register DdsTopicData related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_DdsTopicData_type_identifier(); +/** + * @brief Register DdsTopic related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_DdsTopic_type_identifier(); +/** + * @brief Register MonitoringTopics related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_MonitoringTopics_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopics.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopics.h deleted file mode 100644 index c182594b..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopics.h +++ /dev/null @@ -1,689 +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 MonitoringTopics.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MONITORINGTOPICS_SOURCE) -#define MONITORINGTOPICS_DllAPI __declspec( dllexport ) -#else -#define MONITORINGTOPICS_DllAPI __declspec( dllimport ) -#endif // MONITORINGTOPICS_SOURCE -#else -#define MONITORINGTOPICS_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MONITORINGTOPICS_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure DdsTopicData defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class DdsTopicData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DdsTopicData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DdsTopicData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData( - const DdsTopicData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData( - DdsTopicData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData& operator =( - const DdsTopicData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData& operator =( - DdsTopicData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x DdsTopicData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DdsTopicData& x) const; - - /*! - * @brief Comparison operator. - * @param x DdsTopicData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DdsTopicData& x) const; - - /*! - * @brief This function copies the value in member participant_id - * @param _participant_id New value to be copied in member participant_id - */ - eProsima_user_DllExport void participant_id( - const std::string& _participant_id); - - /*! - * @brief This function moves the value in member participant_id - * @param _participant_id New value to be moved in member participant_id - */ - eProsima_user_DllExport void participant_id( - std::string&& _participant_id); - - /*! - * @brief This function returns a constant reference to member participant_id - * @return Constant reference to member participant_id - */ - eProsima_user_DllExport const std::string& participant_id() const; - - /*! - * @brief This function returns a reference to member participant_id - * @return Reference to member participant_id - */ - eProsima_user_DllExport std::string& participant_id(); - - - /*! - * @brief This function sets a value in member msgs_lost - * @param _msgs_lost New value for member msgs_lost - */ - eProsima_user_DllExport void msgs_lost( - uint32_t _msgs_lost); - - /*! - * @brief This function returns the value of member msgs_lost - * @return Value of member msgs_lost - */ - eProsima_user_DllExport uint32_t msgs_lost() const; - - /*! - * @brief This function returns a reference to member msgs_lost - * @return Reference to member msgs_lost - */ - eProsima_user_DllExport uint32_t& msgs_lost(); - - - /*! - * @brief This function sets a value in member msgs_received - * @param _msgs_received New value for member msgs_received - */ - eProsima_user_DllExport void msgs_received( - uint32_t _msgs_received); - - /*! - * @brief This function returns the value of member msgs_received - * @return Value of member msgs_received - */ - eProsima_user_DllExport uint32_t msgs_received() const; - - /*! - * @brief This function returns a reference to member msgs_received - * @return Reference to member msgs_received - */ - eProsima_user_DllExport uint32_t& msgs_received(); - - - /*! - * @brief This function sets a value in member msg_rx_rate - * @param _msg_rx_rate New value for member msg_rx_rate - */ - eProsima_user_DllExport void msg_rx_rate( - double _msg_rx_rate); - - /*! - * @brief This function returns the value of member msg_rx_rate - * @return Value of member msg_rx_rate - */ - eProsima_user_DllExport double msg_rx_rate() const; - - /*! - * @brief This function returns a reference to member msg_rx_rate - * @return Reference to member msg_rx_rate - */ - eProsima_user_DllExport double& msg_rx_rate(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const DdsTopicData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::string m_participant_id; - uint32_t m_msgs_lost; - uint32_t m_msgs_received; - double m_msg_rx_rate; - -}; - - - - - -/*! - * @brief This class represents the structure DdsTopic defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class DdsTopic -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DdsTopic(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DdsTopic(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic( - const DdsTopic& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic( - DdsTopic&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic& operator =( - const DdsTopic& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic& operator =( - DdsTopic&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x DdsTopic object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DdsTopic& x) const; - - /*! - * @brief Comparison operator. - * @param x DdsTopic object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DdsTopic& x) const; - - /*! - * @brief This function copies the value in member name - * @param _name New value to be copied in member name - */ - eProsima_user_DllExport void name( - const std::string& _name); - - /*! - * @brief This function moves the value in member name - * @param _name New value to be moved in member name - */ - eProsima_user_DllExport void name( - std::string&& _name); - - /*! - * @brief This function returns a constant reference to member name - * @return Constant reference to member name - */ - eProsima_user_DllExport const std::string& name() const; - - /*! - * @brief This function returns a reference to member name - * @return Reference to member name - */ - eProsima_user_DllExport std::string& name(); - - - /*! - * @brief This function copies the value in member type_name - * @param _type_name New value to be copied in member type_name - */ - eProsima_user_DllExport void type_name( - const std::string& _type_name); - - /*! - * @brief This function moves the value in member type_name - * @param _type_name New value to be moved in member type_name - */ - eProsima_user_DllExport void type_name( - std::string&& _type_name); - - /*! - * @brief This function returns a constant reference to member type_name - * @return Constant reference to member type_name - */ - eProsima_user_DllExport const std::string& type_name() const; - - /*! - * @brief This function returns a reference to member type_name - * @return Reference to member type_name - */ - eProsima_user_DllExport std::string& type_name(); - - - /*! - * @brief This function sets a value in member type_discovered - * @param _type_discovered New value for member type_discovered - */ - eProsima_user_DllExport void type_discovered( - bool _type_discovered); - - /*! - * @brief This function returns the value of member type_discovered - * @return Value of member type_discovered - */ - eProsima_user_DllExport bool type_discovered() const; - - /*! - * @brief This function returns a reference to member type_discovered - * @return Reference to member type_discovered - */ - eProsima_user_DllExport bool& type_discovered(); - - - /*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ - eProsima_user_DllExport void type_mismatch( - bool _type_mismatch); - - /*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ - eProsima_user_DllExport bool type_mismatch() const; - - /*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ - eProsima_user_DllExport bool& type_mismatch(); - - - /*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ - eProsima_user_DllExport void qos_mismatch( - bool _qos_mismatch); - - /*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ - eProsima_user_DllExport bool qos_mismatch() const; - - /*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ - eProsima_user_DllExport bool& qos_mismatch(); - - - /*! - * @brief This function copies the value in member data - * @param _data New value to be copied in member data - */ - eProsima_user_DllExport void data( - const std::vector& _data); - - /*! - * @brief This function moves the value in member data - * @param _data New value to be moved in member data - */ - eProsima_user_DllExport void data( - std::vector&& _data); - - /*! - * @brief This function returns a constant reference to member data - * @return Constant reference to member data - */ - eProsima_user_DllExport const std::vector& data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport std::vector& data(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const DdsTopic& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::string m_name; - std::string m_type_name; - bool m_type_discovered; - bool m_type_mismatch; - bool m_qos_mismatch; - std::vector m_data; - -}; - - - - - -/*! - * @brief This class represents the structure MonitoringTopics defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class MonitoringTopics -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitoringTopics(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitoringTopics(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics( - const MonitoringTopics& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics( - MonitoringTopics&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics& operator =( - const MonitoringTopics& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics& operator =( - MonitoringTopics&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MonitoringTopics object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitoringTopics& x) const; - - /*! - * @brief Comparison operator. - * @param x MonitoringTopics object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitoringTopics& x) const; - - /*! - * @brief This function copies the value in member topics - * @param _topics New value to be copied in member topics - */ - eProsima_user_DllExport void topics( - const std::vector& _topics); - - /*! - * @brief This function moves the value in member topics - * @param _topics New value to be moved in member topics - */ - eProsima_user_DllExport void topics( - std::vector&& _topics); - - /*! - * @brief This function returns a constant reference to member topics - * @return Constant reference to member topics - */ - eProsima_user_DllExport const std::vector& topics() const; - - /*! - * @brief This function returns a reference to member topics - * @return Reference to member topics - */ - eProsima_user_DllExport std::vector& topics(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MonitoringTopics& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::vector m_topics; - -}; - - -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsTypeObject.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsTypeObject.h deleted file mode 100644 index 4d54975d..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v1/MonitoringTopicsTypeObject.h +++ /dev/null @@ -1,89 +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 MonitoringTopicsTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MonitoringTopics_SOURCE) -#define MonitoringTopics_DllAPI __declspec( dllexport ) -#else -#define MonitoringTopics_DllAPI __declspec( dllimport ) -#endif // MonitoringTopics_SOURCE -#else -#define MonitoringTopics_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define MonitoringTopics_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerMonitoringTopicsTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetDdsTopicDataIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetDdsTopicDataObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalDdsTopicDataObject(); -eProsima_user_DllExport const TypeObject* GetCompleteDdsTopicDataObject(); - - - - - -eProsima_user_DllExport const TypeIdentifier* GetDdsTopicIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetDdsTopicObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalDdsTopicObject(); -eProsima_user_DllExport const TypeObject* GetCompleteDdsTopicObject(); - - - - - -eProsima_user_DllExport const TypeIdentifier* GetMonitoringTopicsIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMonitoringTopicsObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMonitoringTopicsObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMonitoringTopicsObject(); - - -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.hpp deleted file mode 100644 index aa0de5a1..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.hpp +++ /dev/null @@ -1,69 +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 MonitoringTopicsCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ - -#include - -constexpr uint32_t DdsTopicData_max_cdr_typesize {280UL}; -constexpr uint32_t DdsTopicData_max_key_cdr_typesize {0UL}; - -constexpr uint32_t MonitoringTopics_max_cdr_typesize {2853616UL}; -constexpr uint32_t MonitoringTopics_max_key_cdr_typesize {0UL}; - -constexpr uint32_t DdsTopic_max_cdr_typesize {28536UL}; -constexpr uint32_t DdsTopic_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - - - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const DdsTopicData& data); - - - - - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const DdsTopic& data); - - - - - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const MonitoringTopics& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.ipp deleted file mode 100644 index 0ad02f8a..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsCdrAux.ipp +++ /dev/null @@ -1,331 +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 MonitoringTopicsCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_IPP_ - -#include "MonitoringTopicsCdrAux.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 DdsTopicData& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.participant_id(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.msgs_lost(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.msgs_received(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), - data.msg_rx_rate(), 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 DdsTopicData& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.participant_id() - << eprosima::fastcdr::MemberId(1) << data.msgs_lost() - << eprosima::fastcdr::MemberId(2) << data.msgs_received() - << eprosima::fastcdr::MemberId(3) << data.msg_rx_rate() - ; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - DdsTopicData& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.participant_id(); - break; - - case 1: - dcdr >> data.msgs_lost(); - break; - - case 2: - dcdr >> data.msgs_received(); - break; - - case 3: - dcdr >> data.msg_rx_rate(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const DdsTopicData& data) -{ - static_cast(scdr); - static_cast(data); -} - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const DdsTopic& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.name(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.type_name(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.type_discovered(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), - data.type_mismatch(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), - data.qos_mismatch(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5), - data.data(), 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 DdsTopic& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.name() - << eprosima::fastcdr::MemberId(1) << data.type_name() - << eprosima::fastcdr::MemberId(2) << data.type_discovered() - << eprosima::fastcdr::MemberId(3) << data.type_mismatch() - << eprosima::fastcdr::MemberId(4) << data.qos_mismatch() - << eprosima::fastcdr::MemberId(5) << data.data() - ; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - DdsTopic& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.name(); - break; - - case 1: - dcdr >> data.type_name(); - break; - - case 2: - dcdr >> data.type_discovered(); - break; - - case 3: - dcdr >> data.type_mismatch(); - break; - - case 4: - dcdr >> data.qos_mismatch(); - break; - - case 5: - dcdr >> data.data(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const DdsTopic& data) -{ - static_cast(scdr); - static_cast(data); -} - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const MonitoringTopics& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.topics(), 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 MonitoringTopics& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.topics() - ; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - MonitoringTopics& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.topics(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const MonitoringTopics& data) -{ - static_cast(scdr); - static_cast(data); -} - -} // namespace fastcdr -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_IPP_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.h deleted file mode 100644 index e1e842a4..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.h +++ /dev/null @@ -1,315 +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 MonitoringTopicsPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_PUBSUBTYPES_H_ - -#include -#include -#include -#include -#include - -#include - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated MonitoringTopics is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - - - -/*! - * @brief This class represents the TopicDataType of the type DdsTopicData defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef DdsTopicData type; - - eProsima_user_DllExport DdsTopicDataPubSubType(); - - eProsima_user_DllExport ~DdsTopicDataPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - - - - - -/*! - * @brief This class represents the TopicDataType of the type DdsTopic defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef DdsTopic type; - - eProsima_user_DllExport DdsTopicPubSubType(); - - eProsima_user_DllExport ~DdsTopicPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - - - - - -/*! - * @brief This class represents the TopicDataType of the type MonitoringTopics defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef MonitoringTopics type; - - eProsima_user_DllExport MonitoringTopicsPubSubType(); - - eProsima_user_DllExport ~MonitoringTopicsPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_PUBSUBTYPES_H_ diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsTypeObject.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsTypeObject.h deleted file mode 100644 index 4d54975d..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsTypeObject.h +++ /dev/null @@ -1,89 +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 MonitoringTopicsTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MonitoringTopics_SOURCE) -#define MonitoringTopics_DllAPI __declspec( dllexport ) -#else -#define MonitoringTopics_DllAPI __declspec( dllimport ) -#endif // MonitoringTopics_SOURCE -#else -#define MonitoringTopics_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define MonitoringTopics_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerMonitoringTopicsTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetDdsTopicDataIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetDdsTopicDataObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalDdsTopicDataObject(); -eProsima_user_DllExport const TypeObject* GetCompleteDdsTopicDataObject(); - - - - - -eProsima_user_DllExport const TypeIdentifier* GetDdsTopicIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetDdsTopicObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalDdsTopicObject(); -eProsima_user_DllExport const TypeObject* GetCompleteDdsTopicObject(); - - - - - -eProsima_user_DllExport const TypeIdentifier* GetMonitoringTopicsIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMonitoringTopicsObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMonitoringTopicsObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMonitoringTopicsObject(); - - -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsv1.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsv1.h deleted file mode 100644 index e55f37db..00000000 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/v2/MonitoringTopicsv1.h +++ /dev/null @@ -1,697 +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 MonitoringTopics.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MONITORINGTOPICS_SOURCE) -#define MONITORINGTOPICS_DllAPI __declspec( dllexport ) -#else -#define MONITORINGTOPICS_DllAPI __declspec( dllimport ) -#endif // MONITORINGTOPICS_SOURCE -#else -#define MONITORINGTOPICS_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MONITORINGTOPICS_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure DdsTopicData defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class DdsTopicData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DdsTopicData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DdsTopicData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData( - const DdsTopicData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData( - DdsTopicData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData& operator =( - const DdsTopicData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object DdsTopicData that will be copied. - */ - eProsima_user_DllExport DdsTopicData& operator =( - DdsTopicData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x DdsTopicData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DdsTopicData& x) const; - - /*! - * @brief Comparison operator. - * @param x DdsTopicData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DdsTopicData& x) const; - - /*! - * @brief This function copies the value in member participant_id - * @param _participant_id New value to be copied in member participant_id - */ - eProsima_user_DllExport void participant_id( - const std::string& _participant_id); - - /*! - * @brief This function moves the value in member participant_id - * @param _participant_id New value to be moved in member participant_id - */ - eProsima_user_DllExport void participant_id( - std::string&& _participant_id); - - /*! - * @brief This function returns a constant reference to member participant_id - * @return Constant reference to member participant_id - */ - eProsima_user_DllExport const std::string& participant_id() const; - - /*! - * @brief This function returns a reference to member participant_id - * @return Reference to member participant_id - */ - eProsima_user_DllExport std::string& participant_id(); - - - /*! - * @brief This function sets a value in member msgs_lost - * @param _msgs_lost New value for member msgs_lost - */ - eProsima_user_DllExport void msgs_lost( - uint32_t _msgs_lost); - - /*! - * @brief This function returns the value of member msgs_lost - * @return Value of member msgs_lost - */ - eProsima_user_DllExport uint32_t msgs_lost() const; - - /*! - * @brief This function returns a reference to member msgs_lost - * @return Reference to member msgs_lost - */ - eProsima_user_DllExport uint32_t& msgs_lost(); - - - /*! - * @brief This function sets a value in member msgs_received - * @param _msgs_received New value for member msgs_received - */ - eProsima_user_DllExport void msgs_received( - uint32_t _msgs_received); - - /*! - * @brief This function returns the value of member msgs_received - * @return Value of member msgs_received - */ - eProsima_user_DllExport uint32_t msgs_received() const; - - /*! - * @brief This function returns a reference to member msgs_received - * @return Reference to member msgs_received - */ - eProsima_user_DllExport uint32_t& msgs_received(); - - - /*! - * @brief This function sets a value in member msg_rx_rate - * @param _msg_rx_rate New value for member msg_rx_rate - */ - eProsima_user_DllExport void msg_rx_rate( - double _msg_rx_rate); - - /*! - * @brief This function returns the value of member msg_rx_rate - * @return Value of member msg_rx_rate - */ - eProsima_user_DllExport double msg_rx_rate() const; - - /*! - * @brief This function returns a reference to member msg_rx_rate - * @return Reference to member msg_rx_rate - */ - eProsima_user_DllExport double& msg_rx_rate(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const DdsTopicData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::string m_participant_id; - uint32_t m_msgs_lost; - uint32_t m_msgs_received; - double m_msg_rx_rate; - -}; - - - - - -/*! - * @brief This class represents the structure DdsTopic defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class DdsTopic -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DdsTopic(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DdsTopic(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic( - const DdsTopic& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic( - DdsTopic&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic& operator =( - const DdsTopic& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object DdsTopic that will be copied. - */ - eProsima_user_DllExport DdsTopic& operator =( - DdsTopic&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x DdsTopic object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DdsTopic& x) const; - - /*! - * @brief Comparison operator. - * @param x DdsTopic object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DdsTopic& x) const; - - /*! - * @brief This function copies the value in member name - * @param _name New value to be copied in member name - */ - eProsima_user_DllExport void name( - const std::string& _name); - - /*! - * @brief This function moves the value in member name - * @param _name New value to be moved in member name - */ - eProsima_user_DllExport void name( - std::string&& _name); - - /*! - * @brief This function returns a constant reference to member name - * @return Constant reference to member name - */ - eProsima_user_DllExport const std::string& name() const; - - /*! - * @brief This function returns a reference to member name - * @return Reference to member name - */ - eProsima_user_DllExport std::string& name(); - - - /*! - * @brief This function copies the value in member type_name - * @param _type_name New value to be copied in member type_name - */ - eProsima_user_DllExport void type_name( - const std::string& _type_name); - - /*! - * @brief This function moves the value in member type_name - * @param _type_name New value to be moved in member type_name - */ - eProsima_user_DllExport void type_name( - std::string&& _type_name); - - /*! - * @brief This function returns a constant reference to member type_name - * @return Constant reference to member type_name - */ - eProsima_user_DllExport const std::string& type_name() const; - - /*! - * @brief This function returns a reference to member type_name - * @return Reference to member type_name - */ - eProsima_user_DllExport std::string& type_name(); - - - /*! - * @brief This function sets a value in member type_discovered - * @param _type_discovered New value for member type_discovered - */ - eProsima_user_DllExport void type_discovered( - bool _type_discovered); - - /*! - * @brief This function returns the value of member type_discovered - * @return Value of member type_discovered - */ - eProsima_user_DllExport bool type_discovered() const; - - /*! - * @brief This function returns a reference to member type_discovered - * @return Reference to member type_discovered - */ - eProsima_user_DllExport bool& type_discovered(); - - - /*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ - eProsima_user_DllExport void type_mismatch( - bool _type_mismatch); - - /*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ - eProsima_user_DllExport bool type_mismatch() const; - - /*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ - eProsima_user_DllExport bool& type_mismatch(); - - - /*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ - eProsima_user_DllExport void qos_mismatch( - bool _qos_mismatch); - - /*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ - eProsima_user_DllExport bool qos_mismatch() const; - - /*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ - eProsima_user_DllExport bool& qos_mismatch(); - - - /*! - * @brief This function copies the value in member data - * @param _data New value to be copied in member data - */ - eProsima_user_DllExport void data( - const std::vector& _data); - - /*! - * @brief This function moves the value in member data - * @param _data New value to be moved in member data - */ - eProsima_user_DllExport void data( - std::vector&& _data); - - /*! - * @brief This function returns a constant reference to member data - * @return Constant reference to member data - */ - eProsima_user_DllExport const std::vector& data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport std::vector& data(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const DdsTopic& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::string m_name; - std::string m_type_name; - bool m_type_discovered; - bool m_type_mismatch; - bool m_qos_mismatch; - std::vector m_data; - -}; - - - - - -/*! - * @brief This class represents the structure MonitoringTopics defined by the user in the IDL file. - * @ingroup MonitoringTopics - */ -class MonitoringTopics -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitoringTopics(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitoringTopics(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics( - const MonitoringTopics& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics( - MonitoringTopics&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics& operator =( - const MonitoringTopics& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MonitoringTopics that will be copied. - */ - eProsima_user_DllExport MonitoringTopics& operator =( - MonitoringTopics&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MonitoringTopics object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitoringTopics& x) const; - - /*! - * @brief Comparison operator. - * @param x MonitoringTopics object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitoringTopics& x) const; - - /*! - * @brief This function copies the value in member topics - * @param _topics New value to be copied in member topics - */ - eProsima_user_DllExport void topics( - const std::vector& _topics); - - /*! - * @brief This function moves the value in member topics - * @param _topics New value to be moved in member topics - */ - eProsima_user_DllExport void topics( - std::vector&& _topics); - - /*! - * @brief This function returns a constant reference to member topics - * @return Constant reference to member topics - */ - eProsima_user_DllExport const std::vector& topics() const; - - /*! - * @brief This function returns a reference to member topics - * @return Reference to member topics - */ - eProsima_user_DllExport std::vector& topics(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MonitoringTopics& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::vector m_topics; - -}; - - -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/package.xml b/ddspipe_core/package.xml index 3395a62f..f624d4f6 100644 --- a/ddspipe_core/package.xml +++ b/ddspipe_core/package.xml @@ -16,7 +16,7 @@ cmake - fastrtps + fastdds cpp_utils cmake_utils diff --git a/ddspipe_core/project_settings.cmake b/ddspipe_core/project_settings.cmake index 6d1817ca..0ca58963 100644 --- a/ddspipe_core/project_settings.cmake +++ b/ddspipe_core/project_settings.cmake @@ -26,11 +26,11 @@ set(MODULE_SUMMARY set(MODULE_FIND_PACKAGES fastcdr - fastrtps + fastdds cpp_utils ) -set(fastrtps_MINIMUM_VERSION "2.10") +set(fastdds_MINIMUM_VERSION "3.0.0") set(MODULE_DEPENDENCIES $<$:iphlpapi$Shlwapi> diff --git a/ddspipe_core/src/cpp/communication/dds/Track.cpp b/ddspipe_core/src/cpp/communication/dds/Track.cpp index 4d65c0a2..e1405078 100644 --- a/ddspipe_core/src/cpp/communication/dds/Track.cpp +++ b/ddspipe_core/src/cpp/communication/dds/Track.cpp @@ -24,6 +24,8 @@ #include +#include + namespace eprosima { namespace ddspipe { namespace core { @@ -218,9 +220,9 @@ void Track::transmit_() noexcept // Get data received (send empty data to be created(allocated) in reader) std::unique_ptr data; - utils::ReturnCode ret = reader_->take(data); + auto ret = reader_->take(data); - if (ret == utils::ReturnCode::RETCODE_NO_DATA) + if (ret == utils::ReturnCode::NO_DATA) { // There is no more data; reduce the status by 1 unsigned int previous_status = data_available_status_.fetch_sub(DataAvailableStatus::transmitting_data); @@ -238,7 +240,7 @@ void Track::transmit_() noexcept continue; } } - else if (!ret) + else if (ret != utils::ReturnCode::OK) { // Error reading data logWarning(DDSPIPE_TRACK, "Error taking data in Track " << topic_->serialize() << ". Error code " << ret @@ -259,7 +261,7 @@ void Track::transmit_() noexcept ret = writer_it.second->write(*data); - if (!ret) + if (ret != utils::ReturnCode::OK) { logWarning( DDSPIPE_TRACK, diff --git a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp index 06a5720a..3ef07b2e 100644 --- a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp +++ b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp @@ -300,8 +300,8 @@ void RpcBridge::transmit_( RpcPayloadData& rpc_data = dynamic_cast(*data); - // Will never return \c RETCODE_NO_DATA, otherwise would have finished before - if (!ret) + // Will never return \c NO_DATA, otherwise would have finished before + if (ret != utils::ReturnCode::OK) { // Error reading data logWarning(DDSPIPE_RPCBRIDGE, @@ -351,7 +351,7 @@ void RpcBridge::transmit_( ret = request_writers_[service_registry.first]->write(*data); - if (!ret) + if (ret != utils::ReturnCode::OK) { logWarning(DDSPIPE_RPCBRIDGE, "Error writting request in RpcBridge for service " << rpc_topic_ << ". Error code " << ret << @@ -408,7 +408,7 @@ void RpcBridge::transmit_( ret = reply_writers_[registry_entry.first]->write(*data); - if (!ret) + if (ret != utils::ReturnCode::OK) { logWarning(DDSPIPE_RPCBRIDGE, "Error writting reply in RpcBridge for service " << rpc_topic_ << ". Error code " << ret << "."); diff --git a/ddspipe_core/src/cpp/core/DdsPipe.cpp b/ddspipe_core/src/cpp/core/DdsPipe.cpp index 9de8d3b8..4b63152b 100644 --- a/ddspipe_core/src/cpp/core/DdsPipe.cpp +++ b/ddspipe_core/src/cpp/core/DdsPipe.cpp @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -152,12 +154,12 @@ utils::ReturnCode DdsPipe::enable() noexcept } } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } else { logInfo(DDSPIPE, "Trying to enable an already enabled DDS Pipe."); - return utils::ReturnCode::RETCODE_PRECONDITION_NOT_MET; + return utils::ReturnCode::PRECONDITION_NOT_MET; } } @@ -173,12 +175,12 @@ utils::ReturnCode DdsPipe::disable() noexcept deactivate_all_topics_nts_(); - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } else { logInfo(DDSPIPE, "Trying to disable a disabled DDS Pipe."); - return utils::ReturnCode::RETCODE_PRECONDITION_NOT_MET; + return utils::ReturnCode::PRECONDITION_NOT_MET; } } @@ -202,7 +204,7 @@ utils::ReturnCode DdsPipe::reload_allowed_topics_( if (*allowed_topics == *allowed_topics_) { logDebug(DDSPIPE, "Same configuration, do nothing in reload."); - return utils::ReturnCode::RETCODE_NO_DATA; + return utils::ReturnCode::NO_DATA; } // Set new Allowed list @@ -212,7 +214,7 @@ utils::ReturnCode DdsPipe::reload_allowed_topics_( if (!enabled_) { - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } // It must change the configuration. Check every topic discovered and activate/deactivate it if needed. @@ -251,7 +253,7 @@ utils::ReturnCode DdsPipe::reload_allowed_topics_( } } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } void DdsPipe::discovered_endpoint_( diff --git a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp index 456874e5..4f088085 100644 --- a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp +++ b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp @@ -206,7 +206,7 @@ utils::ReturnCode DiscoveryDatabase::erase_endpoint_( erased_endpoint_callback(endpoint_to_erase); } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } void DiscoveryDatabase::add_endpoint( diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp index bc2cbef8..8207436a 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp @@ -58,7 +58,7 @@ bool PayloadPoolMediator::write( return writer->write(data, params); } -utils::ReturnCode PayloadPoolMediator::write( +fastdds::dds::ReturnCode_t PayloadPoolMediator::write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, const fastrtps::rtps::InstanceHandle_t& handle) diff --git a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp index c39c3689..8266568c 100644 --- a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp +++ b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp @@ -42,13 +42,6 @@ DdsLogConsumer::DdsLogConsumer( fastdds::dds::DomainParticipantQos pqos; pqos.name("DdsLogConsumerParticipant_" + std::to_string(configuration->publish.domain)); - if (configuration->publish.publish_type) - { - // Send the type information - pqos.wire_protocol().builtin.typelookup_config.use_client = false; - pqos.wire_protocol().builtin.typelookup_config.use_server = true; - } - participant_ = fastdds::dds::DomainParticipantFactory::get_instance()->create_participant( configuration->publish.domain, pqos); @@ -65,7 +58,7 @@ DdsLogConsumer::DdsLogConsumer( if (configuration->publish.publish_type) { // Publish the type - registerLogEntryTypes(); + register_LogEntry_type_objects(); type->auto_fill_type_information(true); } diff --git a/ddspipe_core/src/cpp/monitoring/Monitor.cpp b/ddspipe_core/src/cpp/monitoring/Monitor.cpp index b8e8bfda..d0d632e0 100644 --- a/ddspipe_core/src/cpp/monitoring/Monitor.cpp +++ b/ddspipe_core/src/cpp/monitoring/Monitor.cpp @@ -22,17 +22,10 @@ #include #include -#if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) - #include - #include - #include - #include -#else - #include - #include - #include - #include -#endif // if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) +#include +#include +#include +#include namespace eprosima { namespace ddspipe { diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp index 3cae945e..13294180 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp @@ -19,10 +19,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include //To include xtypes constants #include #include @@ -51,7 +52,7 @@ struct TreeNodeType TreeNodeType( std::string member_name, std::string type_kind_name, - fastrtps::types::DynamicType_ptr dynamic_type) + fastdds::dds::DynamicType::_ref_type dynamic_type) : member_name(member_name) , type_kind_name(type_kind_name) , dynamic_type(dynamic_type) @@ -60,58 +61,64 @@ struct TreeNodeType std::string member_name; std::string type_kind_name; - fastrtps::types::DynamicType_ptr dynamic_type; + fastdds::dds::DynamicType::_ref_type dynamic_type; }; // Forward declaration std::string type_kind_to_str( - const fastrtps::types::DynamicType_ptr& type); + const fastdds::dds::DynamicType::_ref_type& type); -fastrtps::types::DynamicType_ptr container_internal_type( - const fastrtps::types::DynamicType_ptr& dyn_type) +fastdds::dds::DynamicType::_ref_type container_internal_type( + const fastdds::dds::DynamicType::_ref_type& dyn_type) { - return dyn_type->get_descriptor()->get_element_type(); + fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + const auto ret = dyn_type->get_descriptor(type_descriptor); + if (ret != fastdds::dds::RETCODE_OK) + { + throw utils::InconsistencyException("No Type Descriptor"); + } + return type_descriptor->element_type(); } std::vector container_size( - const fastrtps::types::DynamicType_ptr& dyn_type, - bool unidimensional = true) + const fastdds::dds::DynamicType::_ref_type& dyn_type) { - if (unidimensional) - { - return {dyn_type->get_descriptor()->get_total_bounds()}; - } - else + fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + const auto ret = dyn_type->get_descriptor(type_descriptor); + if (ret != fastdds::dds::RETCODE_OK) { - std::vector result; - for (unsigned int i = 0; i < dyn_type->get_descriptor()->get_bounds_size(); i++) - { - result.push_back(dyn_type->get_descriptor()->get_bounds(i)); - } - return result; + throw utils::InconsistencyException("No Type Descriptor"); } + return type_descriptor->bound(); } -std::vector> get_members_sorted( - const fastrtps::types::DynamicType_ptr& dyn_type) +std::vector> get_members_sorted( + const fastdds::dds::DynamicType::_ref_type& dyn_type) { - std::vector> result; + std::vector> result; - std::map members; + std::map members; dyn_type->get_all_members(members); for (const auto& member : members) { + fastdds::dds::ObjectName dyn_name = member.second->get_name(); + fastdds::dds::MemberDescriptor::_ref_type member_descriptor; + const auto ret = member.second->get_descriptor(member_descriptor); + if (ret != fastdds::dds::RETCODE_OK) + { + throw utils::InconsistencyException("No Member Descriptor"); + } result.emplace_back( - std::make_pair( - member.second->get_name(), - member.second->get_descriptor()->get_type())); + std::make_pair( + dyn_name.to_string(), + std::move(member_descriptor->type()))); } return result; } std::string array_kind_to_str( - const fastrtps::types::DynamicType_ptr& dyn_type) + const fastdds::dds::DynamicType::_ref_type& dyn_type) { auto internal_type = container_internal_type(dyn_type); auto this_array_size = container_size(dyn_type); @@ -128,7 +135,7 @@ std::string array_kind_to_str( } std::string sequence_kind_to_str( - const fastrtps::types::DynamicType_ptr& dyn_type) + const fastdds::dds::DynamicType::_ref_type& dyn_type) { auto internal_type = container_internal_type(dyn_type); auto this_sequence_size = container_size(dyn_type); @@ -138,7 +145,7 @@ std::string sequence_kind_to_str( for (const auto& bound : this_sequence_size) { - if (bound != fastrtps::types::BOUND_UNLIMITED) + if (bound != fastdds::dds::xtypes::INVALID_LBOUND) { ss << ", " << bound; } @@ -149,84 +156,89 @@ std::string sequence_kind_to_str( } std::string map_kind_to_str( - const fastrtps::types::DynamicType_ptr& dyn_type) + const fastdds::dds::DynamicType::_ref_type& dyn_type) { std::stringstream ss; - - auto key_type = dyn_type->get_descriptor()->get_key_element_type(); - auto value_type = dyn_type->get_descriptor()->get_element_type(); + fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + const auto ret = dyn_type->get_descriptor(type_descriptor); + if (ret != fastdds::dds::RETCODE_OK) + { + throw utils::InconsistencyException("No Type Descriptor"); + } + auto key_type = type_descriptor->key_element_type(); + auto value_type = type_descriptor->element_type(); ss << "map<" << type_kind_to_str(key_type) << ", " << type_kind_to_str(value_type) << ">"; return ss.str(); } std::string type_kind_to_str( - const fastrtps::types::DynamicType_ptr& dyn_type) + const fastdds::dds::DynamicType::_ref_type& dyn_type) { switch (dyn_type->get_kind()) { - case fastrtps::types::TK_BOOLEAN: + case fastdds::dds::xtypes::TK_BOOLEAN: return "boolean"; - case fastrtps::types::TK_BYTE: + case fastdds::dds::xtypes::TK_BYTE: return "octet"; - case fastrtps::types::TK_INT16: + case fastdds::dds::xtypes::TK_INT16: return "short"; - case fastrtps::types::TK_INT32: + case fastdds::dds::xtypes::TK_INT32: return "long"; - case fastrtps::types::TK_INT64: + case fastdds::dds::xtypes::TK_INT64: return "long long"; - case fastrtps::types::TK_UINT16: + case fastdds::dds::xtypes::TK_UINT16: return "unsigned short"; - case fastrtps::types::TK_UINT32: + case fastdds::dds::xtypes::TK_UINT32: return "unsigned long"; - case fastrtps::types::TK_UINT64: + case fastdds::dds::xtypes::TK_UINT64: return "unsigned long long"; - case fastrtps::types::TK_FLOAT32: + case fastdds::dds::xtypes::TK_FLOAT32: return "float"; - case fastrtps::types::TK_FLOAT64: + case fastdds::dds::xtypes::TK_FLOAT64: return "double"; - case fastrtps::types::TK_FLOAT128: + case fastdds::dds::xtypes::TK_FLOAT128: return "long double"; - case fastrtps::types::TK_CHAR8: + case fastdds::dds::xtypes::TK_CHAR8: return "char"; - case fastrtps::types::TK_CHAR16: + case fastdds::dds::xtypes::TK_CHAR16: return "wchar"; - case fastrtps::types::TK_STRING8: + case fastdds::dds::xtypes::TK_STRING8: return "string"; - case fastrtps::types::TK_STRING16: + case fastdds::dds::xtypes::TK_STRING16: return "wstring"; - case fastrtps::types::TK_ARRAY: + case fastdds::dds::xtypes::TK_ARRAY: return array_kind_to_str(dyn_type); - case fastrtps::types::TK_SEQUENCE: + case fastdds::dds::xtypes::TK_SEQUENCE: return sequence_kind_to_str(dyn_type); - case fastrtps::types::TK_MAP: + case fastdds::dds::xtypes::TK_MAP: return map_kind_to_str(dyn_type); - case fastrtps::types::TK_STRUCTURE: - case fastrtps::types::TK_ENUM: - case fastrtps::types::TK_UNION: - return dyn_type->get_name(); + case fastdds::dds::xtypes::TK_STRUCTURE: + case fastdds::dds::xtypes::TK_ENUM: + case fastdds::dds::xtypes::TK_UNION: + return (dyn_type->get_name()).to_string(); - case fastrtps::types::TK_BITSET: - case fastrtps::types::TK_BITMASK: - case fastrtps::types::TK_NONE: + case fastdds::dds::xtypes::TK_BITSET: + case fastdds::dds::xtypes::TK_BITMASK: + case fastdds::dds::xtypes::TK_NONE: throw utils::UnsupportedException( STR_ENTRY << "Type " << dyn_type->get_name() << " is not supported."); @@ -238,23 +250,23 @@ std::string type_kind_to_str( } utils::TreeNode generate_dyn_type_tree( - const fastrtps::types::DynamicType_ptr& type, + const fastdds::dds::DynamicType::_ref_type& type, const std::string& member_name = "PARENT") { // Get kind - fastrtps::types::TypeKind kind = type->get_kind(); + fastdds::dds::xtypes::TypeKind kind = type->get_kind(); switch (kind) { - case fastrtps::types::TK_STRUCTURE: + case fastdds::dds::xtypes::TK_STRUCTURE: { // If is struct, the call is recursive. // Create new tree node - utils::TreeNode parent(member_name, type->get_name(), type); + utils::TreeNode parent(member_name, (type->get_name()).to_string(), type); // Get all members of this struct std::vector> members_by_name = get_members_sorted(type); + fastdds::dds::DynamicType::_ref_type>> members_by_name = get_members_sorted(type); for (const auto& member : members_by_name) { @@ -265,8 +277,8 @@ utils::TreeNode generate_dyn_type_tree( return parent; } - case fastrtps::types::TK_ARRAY: - case fastrtps::types::TK_SEQUENCE: + case fastdds::dds::xtypes::TK_ARRAY: + case fastdds::dds::xtypes::TK_SEQUENCE: { // If container (array or struct) has exactly one branch // Calculate child branch @@ -291,7 +303,7 @@ std::ostream& node_to_str( { os << TAB_SEPARATOR; - if (node.info.dynamic_type->get_kind() == fastrtps::types::TK_ARRAY) + if (node.info.dynamic_type->get_kind() == fastdds::dds::xtypes::TK_ARRAY) { auto dim_pos = node.info.type_kind_name.find("["); auto kind_name_str = node.info.type_kind_name.substr(0, dim_pos); @@ -333,7 +345,7 @@ std::ostream& enum_to_str( { os << "enum " << node.info.type_kind_name << TYPE_OPENING << TAB_SEPARATOR; - std::map members; + std::map members; node.info.dynamic_type->get_all_members(members); bool first_iter = true; for (const auto& member : members) @@ -357,14 +369,26 @@ std::ostream& union_to_str( std::ostream& os, const utils::TreeNode& node) { + fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + const auto ret = node.info.dynamic_type->get_descriptor(type_descriptor); + if (ret != fastdds::dds::RETCODE_OK) + { + throw utils::InconsistencyException("No Type Descriptor"); + } os << "union " << node.info.type_kind_name << " switch (" << type_kind_to_str( - node.info.dynamic_type->get_descriptor()->get_discriminator_type()) << ")" << TYPE_OPENING; + type_descriptor->discriminator_type()) << ")" << TYPE_OPENING; - std::map members; + std::map members; node.info.dynamic_type->get_all_members(members); // WARNING: Default case not included in this collection, and currently not available for (const auto& member : members) { - auto labels = member.second->get_union_labels(); // WARNING: There might be casting issues as discriminant type is currently not taken into consideration + fastdds::dds::MemberDescriptor::_ref_type member_descriptor; + const auto ret = member.second->get_descriptor(member_descriptor); + if (ret != fastdds::dds::RETCODE_OK) + { + throw utils::InconsistencyException("No Member Descriptor"); + } + auto labels = member_descriptor->label(); // WARNING: There might be casting issues as discriminant type is currently not taken into consideration bool first_iter = true; for (const auto& label : labels) { @@ -381,7 +405,7 @@ std::ostream& union_to_str( os << "case " << std::to_string(label) << ":"; } - os << "\n" << TAB_SEPARATOR << TAB_SEPARATOR << type_kind_to_str(member.second->get_descriptor()->get_type()) << + os << "\n" << TAB_SEPARATOR << TAB_SEPARATOR << type_kind_to_str(member_descriptor->type()) << " " << member.second->get_name() << ";\n"; @@ -410,15 +434,15 @@ std::string generate_dyn_type_schema_from_tree( { switch (kind) { - case fastrtps::types::TK_STRUCTURE: + case fastdds::dds::xtypes::TK_STRUCTURE: struct_to_str(ss, node); break; - case fastrtps::types::TK_ENUM: + case fastdds::dds::xtypes::TK_ENUM: enum_to_str(ss, node); break; - case fastrtps::types::TK_UNION: + case fastdds::dds::xtypes::TK_UNION: union_to_str(ss, node); break; @@ -438,7 +462,7 @@ std::string generate_dyn_type_schema_from_tree( } std::string generate_idl_schema( - const fastrtps::types::DynamicType_ptr& dynamic_type) + const fastdds::dds::DynamicType::_ref_type& dynamic_type) { // Generate type tree utils::TreeNode parent_type = generate_dyn_type_tree(dynamic_type); diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index 8675e7b8..a483718e 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -19,10 +19,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include //To include xtypes constants #include #include @@ -60,53 +61,59 @@ struct TreeNodeType // Forward declaration std::string type_kind_to_str( - const fastrtps::types::DynamicType_ptr& type); + const fastdds::dds::DynamicType::_ref_type& type); -fastrtps::types::DynamicType_ptr container_internal_type( - const fastrtps::types::DynamicType_ptr& dyn_type) +fastdds::dds::DynamicType::_ref_type container_internal_type( + const fastdds::dds::DynamicType::_ref_type& dyn_type) { - return dyn_type->get_descriptor()->get_element_type(); + fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + const auto ret = dyn_type->get_descriptor(type_descriptor); + if (ret != fastdds::dds::RETCODE_OK) + { + throw utils::InconsistencyException("No Type Descriptor"); + } + return type_descriptor->element_type(); } std::vector array_size( - const fastrtps::types::DynamicType_ptr& dyn_type, - bool unidimensional = true) + const fastdds::dds::DynamicType::_ref_type& dyn_type) { - if (unidimensional) - { - return {dyn_type->get_descriptor()->get_total_bounds()}; - } - else + fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + const auto ret = dyn_type->get_descriptor(type_descriptor); + if (ret != fastdds::dds::RETCODE_OK) { - std::vector result; - for (unsigned int i = 0; i < dyn_type->get_descriptor()->get_bounds_size(); i++) - { - result.push_back(dyn_type->get_descriptor()->get_bounds(i)); - } - return result; + throw utils::InconsistencyException("No Type Descriptor"); } + return type_descriptor->bound(); } -std::vector> get_members_sorted( - const fastrtps::types::DynamicType_ptr& dyn_type) +std::vector> get_members_sorted( + const fastdds::dds::DynamicType::_ref_type& dyn_type) { - std::vector> result; + std::vector> result; - std::map members; + std::map members; dyn_type->get_all_members(members); for (const auto& member : members) { + fastdds::dds::ObjectName dyn_name = member.second->get_name(); + fastdds::dds::MemberDescriptor::_ref_type member_descriptor; + const auto ret = member.second->get_descriptor(member_descriptor); + if (ret != fastdds::dds::RETCODE_OK) + { + throw utils::InconsistencyException("No Member Descriptor"); + } result.emplace_back( - std::make_pair( - utils::demangle_if_ros_type(member.second->get_name()), - member.second->get_descriptor()->get_type())); + std::make_pair( + utils::demangle_if_ros_type(dyn_name.to_string()), + std::move(member_descriptor->type()))); } return result; } std::string container_kind_to_str( - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, bool allow_bounded = false) { auto internal_type = container_internal_type(dyn_type); @@ -117,7 +124,7 @@ std::string container_kind_to_str( for (const auto& bound : this_array_size) { - if (bound != fastrtps::types::BOUND_UNLIMITED) + if (bound != fastdds::dds::xtypes::INVALID_LBOUND) { if (allow_bounded) { @@ -138,92 +145,92 @@ std::string container_kind_to_str( } std::string type_kind_to_str( - const fastrtps::types::DynamicType_ptr& dyn_type) + const fastdds::dds::DynamicType::_ref_type& dyn_type) { switch (dyn_type->get_kind()) { - case fastrtps::types::TK_BOOLEAN: + case fastdds::dds::xtypes::TK_BOOLEAN: return "bool"; - case fastrtps::types::TK_BYTE: + case fastdds::dds::xtypes::TK_BYTE: return "uint8"; - case fastrtps::types::TK_INT16: + case fastdds::dds::xtypes::TK_INT16: return "int16"; - case fastrtps::types::TK_INT32: + case fastdds::dds::xtypes::TK_INT32: return "int32"; - case fastrtps::types::TK_INT64: + case fastdds::dds::xtypes::TK_INT64: return "int64"; - case fastrtps::types::TK_UINT16: + case fastdds::dds::xtypes::TK_UINT16: return "uint16"; - case fastrtps::types::TK_UINT32: + case fastdds::dds::xtypes::TK_UINT32: return "uint32"; - case fastrtps::types::TK_UINT64: + case fastdds::dds::xtypes::TK_UINT64: return "uint64"; - case fastrtps::types::TK_FLOAT32: + case fastdds::dds::xtypes::TK_FLOAT32: return "float32"; - case fastrtps::types::TK_FLOAT64: + case fastdds::dds::xtypes::TK_FLOAT64: return "float64"; - case fastrtps::types::TK_CHAR8: + case fastdds::dds::xtypes::TK_CHAR8: return "int8"; - case fastrtps::types::TK_STRING8: + case fastdds::dds::xtypes::TK_STRING8: return "string"; - case fastrtps::types::TK_ARRAY: + case fastdds::dds::xtypes::TK_ARRAY: return container_kind_to_str(dyn_type); - case fastrtps::types::TK_SEQUENCE: + case fastdds::dds::xtypes::TK_SEQUENCE: return container_kind_to_str(dyn_type, true); - case fastrtps::types::TK_STRUCTURE: - return utils::demangle_if_ros_type(dyn_type->get_name()); - - case fastrtps::types::TK_FLOAT128: - case fastrtps::types::TK_CHAR16: - case fastrtps::types::TK_STRING16: - case fastrtps::types::TK_ENUM: - case fastrtps::types::TK_BITSET: - case fastrtps::types::TK_MAP: - case fastrtps::types::TK_UNION: - case fastrtps::types::TK_NONE: + case fastdds::dds::xtypes::TK_STRUCTURE: + return utils::demangle_if_ros_type((dyn_type->get_name()).to_string()); + + case fastdds::dds::xtypes::TK_FLOAT128: + case fastdds::dds::xtypes::TK_CHAR16: + case fastdds::dds::xtypes::TK_STRING16: + case fastdds::dds::xtypes::TK_ENUM: + case fastdds::dds::xtypes::TK_BITSET: + case fastdds::dds::xtypes::TK_MAP: + case fastdds::dds::xtypes::TK_UNION: + case fastdds::dds::xtypes::TK_NONE: throw utils::UnsupportedException( STR_ENTRY << "Type " << utils::demangle_if_ros_type( - dyn_type->get_name()) << " is not supported in ROS2 msg."); + (dyn_type->get_name()).to_string()) << " is not supported in ROS2 msg."); default: throw utils::InconsistencyException( STR_ENTRY << "Type " << utils::demangle_if_ros_type( - dyn_type->get_name()) << " has not correct kind."); + (dyn_type->get_name()).to_string()) << " has not correct kind."); } } utils::TreeNode generate_dyn_type_tree( - const fastrtps::types::DynamicType_ptr& type, + const fastdds::dds::DynamicType::_ref_type& type, const std::string& member_name = "PARENT") { // Get kind - fastrtps::types::TypeKind kind = type->get_kind(); + fastdds::dds::xtypes::TypeKind kind = type->get_kind(); switch (kind) { - case fastrtps::types::TK_STRUCTURE: + case fastdds::dds::xtypes::TK_STRUCTURE: { // If is struct, the call is recursive. // Create new tree node - utils::TreeNode parent(member_name, utils::demangle_if_ros_type(type->get_name()), true); + utils::TreeNode parent(member_name, utils::demangle_if_ros_type((type->get_name()).to_string()), true); // Get all members of this struct std::vector> members_by_name = get_members_sorted(type); + fastdds::dds::DynamicType::_ref_type>> members_by_name = get_members_sorted(type); for (const auto& member : members_by_name) { @@ -234,8 +241,8 @@ utils::TreeNode generate_dyn_type_tree( return parent; } - case fastrtps::types::TK_ARRAY: - case fastrtps::types::TK_SEQUENCE: + case fastdds::dds::xtypes::TK_ARRAY: + case fastdds::dds::xtypes::TK_SEQUENCE: { // If container (array or struct) has exactly one branch // Calculate child branch @@ -312,7 +319,7 @@ std::string generate_dyn_type_schema_from_tree( } std::string generate_ros2_schema( - const fastrtps::types::DynamicType_ptr& dynamic_type) + const fastdds::dds::DynamicType::_ref_type& dynamic_type) { // Generate type tree utils::TreeNode parent_type = generate_dyn_type_tree(dynamic_type); diff --git a/ddspipe_core/src/cpp/types/logging/v1/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx similarity index 90% rename from ddspipe_core/src/cpp/types/logging/v1/LogEntryPubSubTypes.cxx rename to ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx index 9b6231dd..07af35a5 100644 --- a/ddspipe_core/src/cpp/types/logging/v1/LogEntryPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx @@ -19,36 +19,27 @@ * This file was generated by the tool fastddsgen. */ +#include +#include #include -#include -#include +#include +#include using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - - - - - - - - - LogEntryPubSubType::LogEntryPubSubType() { setName("LogEntry"); uint32_t type_size = #if FASTCDR_VERSION_MAJOR == 1 - static_cast(LogEntry::getMaxCdrSerializedSize()); + static_cast(LogEntry::getMaxCdrSerializedSize()); #else - LogEntry_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 + LogEntry_max_cdr_typesize; +#endif type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ m_typeSize = type_size + 4; /*encapsulation*/ m_isGetKeyDefined = true; @@ -159,8 +150,8 @@ std::function LogEntryPubSubType::getSerializedSizeProvider( 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*/; + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) { @@ -198,8 +189,7 @@ bool LogEntryPubSubType::getKey( LogEntry_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::XCDRv1); #if FASTCDR_VERSION_MAJOR == 1 p_type->serializeKey(ser); #else @@ -228,3 +218,12 @@ bool LogEntryPubSubType::getKey( } return true; } + +void LogEntryPubSubType::register_type_object_representation() const +{ + register_LogEntry_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx new file mode 100644 index 00000000..8e3bd715 --- /dev/null +++ b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx @@ -0,0 +1,580 @@ +// 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 LogEntryTypeObjectSupport.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. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_LogEntry_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_LogEntry_type_identifier(); + + }); +} + +void register_LogEntry_type_identifier() +{ + { + StructTypeFlag struct_flags_LogEntry = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_LogEntry; + TypeIdentifierPair type_ids_LogEntry; + QualifiedTypeName type_name_LogEntry = "LogEntry"; + eprosima::fastcdr::optional type_ann_builtin_LogEntry; + eprosima::fastcdr::optional ann_custom_LogEntry; + CompleteTypeDetail detail_LogEntry = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_LogEntry, ann_custom_LogEntry, type_name_LogEntry.to_string()); + CompleteStructHeader header_LogEntry; + header_LogEntry = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_LogEntry); + CompleteStructMemberSeq member_seq_LogEntry; + { + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_LogEntry); + + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "event Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_event = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, true, false); + CommonStructMember common_event; + MemberId member_id_event = 0x00000000; + if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_event = TypeObjectUtils::build_common_struct_member(member_id_event, member_flags_event, type_ids_LogEntry.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_event = TypeObjectUtils::build_common_struct_member(member_id_event, member_flags_event, type_ids_LogEntry.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure event member TypeIdentifier inconsistent."); + return; + } + MemberName name_event = "event"; + eprosima::fastcdr::optional member_ann_builtin_event; + ann_custom_LogEntry.reset(); + AppliedAnnotationSeq tmp_ann_custom_event; + eprosima::fastcdr::optional unit_event; + eprosima::fastcdr::optional min_event; + eprosima::fastcdr::optional max_event; + eprosima::fastcdr::optional hash_id_event; + if (unit_event.has_value() || min_event.has_value() || max_event.has_value() || hash_id_event.has_value()) + { + member_ann_builtin_event = TypeObjectUtils::build_applied_builtin_member_annotations(unit_event, min_event, max_event, hash_id_event); + } + if (!tmp_ann_custom_event.empty()) + { + ann_custom_LogEntry = tmp_ann_custom_event; + } + CompleteMemberDetail detail_event = TypeObjectUtils::build_complete_member_detail(name_event, member_ann_builtin_event, ann_custom_LogEntry); + CompleteStructMember member_event = TypeObjectUtils::build_complete_struct_member(common_event, detail_event); + TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_event); + } + { + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "Kind", type_ids_LogEntry); + + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + EnumTypeFlag enum_flags_Kind = 0; + BitBound bit_bound_Kind = 32; + CommonEnumeratedHeader common_Kind = TypeObjectUtils::build_common_enumerated_header(bit_bound_Kind); + QualifiedTypeName type_name_Kind = "Kind"; + eprosima::fastcdr::optional type_ann_builtin_Kind; + eprosima::fastcdr::optional ann_custom_Kind; + CompleteTypeDetail detail_Kind = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Kind, ann_custom_Kind, type_name_Kind.to_string()); + CompleteEnumeratedHeader header_Kind = TypeObjectUtils::build_complete_enumerated_header(common_Kind, detail_Kind); + CompleteEnumeratedLiteralSeq literal_seq_Kind; + { + EnumeratedLiteralFlag flags_Info = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Info = TypeObjectUtils::build_common_enumerated_literal(0, flags_Info); + eprosima::fastcdr::optional member_ann_builtin_Info; + ann_custom_Kind.reset(); + MemberName name_Info = "Info"; + CompleteMemberDetail detail_Info = TypeObjectUtils::build_complete_member_detail(name_Info, member_ann_builtin_Info, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Info = TypeObjectUtils::build_complete_enumerated_literal(common_Info, detail_Info); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Info); + } + { + EnumeratedLiteralFlag flags_Warning = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Warning = TypeObjectUtils::build_common_enumerated_literal(1, flags_Warning); + eprosima::fastcdr::optional member_ann_builtin_Warning; + ann_custom_Kind.reset(); + MemberName name_Warning = "Warning"; + CompleteMemberDetail detail_Warning = TypeObjectUtils::build_complete_member_detail(name_Warning, member_ann_builtin_Warning, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Warning = TypeObjectUtils::build_complete_enumerated_literal(common_Warning, detail_Warning); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Warning); + } + { + EnumeratedLiteralFlag flags_Error = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Error = TypeObjectUtils::build_common_enumerated_literal(2, flags_Error); + eprosima::fastcdr::optional member_ann_builtin_Error; + ann_custom_Kind.reset(); + MemberName name_Error = "Error"; + CompleteMemberDetail detail_Error = TypeObjectUtils::build_complete_member_detail(name_Error, member_ann_builtin_Error, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Error = TypeObjectUtils::build_complete_enumerated_literal(common_Error, detail_Error); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Error); + } + CompleteEnumeratedType enumerated_type_Kind = TypeObjectUtils::build_complete_enumerated_type(enum_flags_Kind, header_Kind, + literal_seq_Kind); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_Kind, type_name_Kind.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Kind already registered in TypeObjectRegistry for a different type."); + } + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "Kind", type_ids_LogEntry); + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Kind: Given Enum TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_kind = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_kind; + MemberId member_id_kind = 0x00000001; + if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, member_flags_kind, type_ids_LogEntry.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, member_flags_kind, type_ids_LogEntry.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure kind member TypeIdentifier inconsistent."); + return; + } + MemberName name_kind = "kind"; + eprosima::fastcdr::optional member_ann_builtin_kind; + ann_custom_LogEntry.reset(); + CompleteMemberDetail detail_kind = TypeObjectUtils::build_complete_member_detail(name_kind, member_ann_builtin_kind, ann_custom_LogEntry); + CompleteStructMember member_kind = TypeObjectUtils::build_complete_struct_member(common_kind, detail_kind); + TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_kind); + } + { + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_LogEntry); + + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_LogEntry); + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_category = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_category; + MemberId member_id_category = 0x00000002; + if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_category = TypeObjectUtils::build_common_struct_member(member_id_category, member_flags_category, type_ids_LogEntry.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_category = TypeObjectUtils::build_common_struct_member(member_id_category, member_flags_category, type_ids_LogEntry.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure category member TypeIdentifier inconsistent."); + return; + } + MemberName name_category = "category"; + eprosima::fastcdr::optional member_ann_builtin_category; + ann_custom_LogEntry.reset(); + CompleteMemberDetail detail_category = TypeObjectUtils::build_complete_member_detail(name_category, member_ann_builtin_category, ann_custom_LogEntry); + CompleteStructMember member_category = TypeObjectUtils::build_complete_struct_member(common_category, detail_category); + TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_category); + } + { + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_LogEntry); + + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_LogEntry); + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_message; + MemberId member_id_message = 0x00000003; + if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_LogEntry.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_LogEntry.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure message member TypeIdentifier inconsistent."); + return; + } + MemberName name_message = "message"; + eprosima::fastcdr::optional member_ann_builtin_message; + ann_custom_LogEntry.reset(); + CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_LogEntry); + CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message); + TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_message); + } + { + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_LogEntry); + + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_LogEntry); + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_timestamp = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_timestamp; + MemberId member_id_timestamp = 0x00000004; + if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, member_flags_timestamp, type_ids_LogEntry.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && + EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && + (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, member_flags_timestamp, type_ids_LogEntry.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure timestamp member TypeIdentifier inconsistent."); + return; + } + MemberName name_timestamp = "timestamp"; + eprosima::fastcdr::optional member_ann_builtin_timestamp; + ann_custom_LogEntry.reset(); + CompleteMemberDetail detail_timestamp = TypeObjectUtils::build_complete_member_detail(name_timestamp, member_ann_builtin_timestamp, ann_custom_LogEntry); + CompleteStructMember member_timestamp = TypeObjectUtils::build_complete_struct_member(common_timestamp, detail_timestamp); + TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_timestamp); + } + CompleteStructType struct_type_LogEntry = TypeObjectUtils::build_complete_struct_type(struct_flags_LogEntry, header_LogEntry, member_seq_LogEntry); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_LogEntry, type_name_LogEntry.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "LogEntry already registered in TypeObjectRegistry for a different type."); + } + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "LogEntry", type_ids_LogEntry); + if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "LogEntry: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/src/cpp/types/logging/v1/LogEntry.cxx b/ddspipe_core/src/cpp/types/logging/v1/LogEntry.cxx deleted file mode 100644 index 564551ce..00000000 --- a/ddspipe_core/src/cpp/types/logging/v1/LogEntry.cxx +++ /dev/null @@ -1,476 +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 LogEntry.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#include - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { -namespace internal { - -enum class Size -{ - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size( - int s) -{ - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH -{ - using type = std::uint8_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint16_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint32_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint64_t; -}; -} // namespace internal - -template -struct FindType -{ - using type = typename internal::FindTypeH::type; -}; -} // namespace helper - -#define LogEntry_max_cdr_typesize 792ULL; - - - - -LogEntry::LogEntry() -{ - // long m_event - m_event = 0; - // Kind m_kind - m_kind = ::Info; - // /type_d() m_category - - // /type_d() m_message - - // /type_d() m_timestamp - - - // Just to register all known types - registerLogEntryTypes(); -} - -LogEntry::~LogEntry() -{ -} - -LogEntry::LogEntry( - const LogEntry& x) -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = x.m_category; - - - m_message = x.m_message; - - - m_timestamp = x.m_timestamp; - -} - -LogEntry::LogEntry( - LogEntry&& x) noexcept -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = std::move(x.m_category); - - - m_message = std::move(x.m_message); - - - m_timestamp = std::move(x.m_timestamp); - -} - -LogEntry& LogEntry::operator =( - const LogEntry& x) -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = x.m_category; - - - m_message = x.m_message; - - - m_timestamp = x.m_timestamp; - - return *this; -} - -LogEntry& LogEntry::operator =( - LogEntry&& x) noexcept -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = std::move(x.m_category); - - - m_message = std::move(x.m_message); - - - m_timestamp = std::move(x.m_timestamp); - - return *this; -} - -bool LogEntry::operator ==( - const LogEntry& x) const -{ - return (m_event == x.m_event && - m_kind == x.m_kind && - m_category == x.m_category && - m_message == x.m_message && - m_timestamp == x.m_timestamp); -} - -bool LogEntry::operator !=( - const LogEntry& x) const -{ - return !(*this == x); -} - -size_t LogEntry::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return LogEntry_max_cdr_typesize; -} - -size_t LogEntry::getCdrSerializedSize( - const LogEntry& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.category().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.timestamp().size() + 1; - - - return current_alignment - initial_alignment; -} - -void LogEntry::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_event; - - scdr << (uint32_t)m_kind; - - scdr << m_category.c_str(); - - scdr << m_message.c_str(); - - scdr << m_timestamp.c_str(); - -} - -void LogEntry::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_event; - - - - { - uint32_t enum_value = 0; - dcdr >> enum_value; - m_kind = (Kind)enum_value; - } - - - - dcdr >> m_category; - - - - dcdr >> m_message; - - - - dcdr >> m_timestamp; - - -} - -bool LogEntry::isKeyDefined() -{ - return true; -} - -void LogEntry::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - - scdr << m_event; - - - - - -} - -/*! - * @brief This function sets a value in member event - * @param _event New value for member event - */ -void LogEntry::event( - int32_t _event) -{ - m_event = _event; -} - -/*! - * @brief This function returns the value of member event - * @return Value of member event - */ -int32_t LogEntry::event() const -{ - return m_event; -} - -/*! - * @brief This function returns a reference to member event - * @return Reference to member event - */ -int32_t& LogEntry::event() -{ - return m_event; -} - -/*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ -void LogEntry::kind( - Kind _kind) -{ - m_kind = _kind; -} - -/*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ -Kind LogEntry::kind() const -{ - return m_kind; -} - -/*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ -Kind& LogEntry::kind() -{ - return m_kind; -} - -/*! - * @brief This function copies the value in member category - * @param _category New value to be copied in member category - */ -void LogEntry::category( - const std::string& _category) -{ - m_category = _category; -} - -/*! - * @brief This function moves the value in member category - * @param _category New value to be moved in member category - */ -void LogEntry::category( - std::string&& _category) -{ - m_category = std::move(_category); -} - -/*! - * @brief This function returns a constant reference to member category - * @return Constant reference to member category - */ -const std::string& LogEntry::category() const -{ - return m_category; -} - -/*! - * @brief This function returns a reference to member category - * @return Reference to member category - */ -std::string& LogEntry::category() -{ - return m_category; -} - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void LogEntry::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void LogEntry::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& LogEntry::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& LogEntry::message() -{ - return m_message; -} - -/*! - * @brief This function copies the value in member timestamp - * @param _timestamp New value to be copied in member timestamp - */ -void LogEntry::timestamp( - const std::string& _timestamp) -{ - m_timestamp = _timestamp; -} - -/*! - * @brief This function moves the value in member timestamp - * @param _timestamp New value to be moved in member timestamp - */ -void LogEntry::timestamp( - std::string&& _timestamp) -{ - m_timestamp = std::move(_timestamp); -} - -/*! - * @brief This function returns a constant reference to member timestamp - * @return Constant reference to member timestamp - */ -const std::string& LogEntry::timestamp() const -{ - return m_timestamp; -} - -/*! - * @brief This function returns a reference to member timestamp - * @return Reference to member timestamp - */ -std::string& LogEntry::timestamp() -{ - return m_timestamp; -} diff --git a/ddspipe_core/src/cpp/types/logging/v1/LogEntryTypeObject.cxx b/ddspipe_core/src/cpp/types/logging/v1/LogEntryTypeObject.cxx deleted file mode 100644 index 3335f42d..00000000 --- a/ddspipe_core/src/cpp/types/logging/v1/LogEntryTypeObject.cxx +++ /dev/null @@ -1,622 +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 LogEntryTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // ifdef _WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerLogEntryTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory* factory = TypeObjectFactory::get_instance(); - factory->add_type_object("Kind", GetKindIdentifier(true), - GetKindObject(true)); - factory->add_type_object("Kind", GetKindIdentifier(false), - GetKindObject(false)); - - - factory->add_type_object("LogEntry", GetLogEntryIdentifier(true), - GetLogEntryObject(true)); - factory->add_type_object("LogEntry", GetLogEntryIdentifier(false), - GetLogEntryObject(false)); - - }); -} - -const TypeIdentifier* GetKindIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("Kind", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetKindObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("Kind", complete); -} - -const TypeObject* GetKindObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("Kind", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteKindObject(); - } - // else - return GetMinimalKindObject(); -} - -const TypeObject* GetMinimalKindObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("Kind", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_ENUM); - - // No flags apply - //type_object->minimal().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->minimal().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->minimal().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->minimal().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - - uint32_t value = 0; - MinimalEnumeratedLiteral mel_Info; - mel_Info.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_Info.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_Info.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_Info.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_Info.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_Info.common().flags().IS_KEY(false); // Doesn't apply - mel_Info.common().flags().IS_DEFAULT(false); - mel_Info.common().value(value++); - MD5 Info_hash("Info"); - for (int i = 0; i < 4; ++i) - { - mel_Info.detail().name_hash()[i] = Info_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_Info); - - MinimalEnumeratedLiteral mel_Warning; - mel_Warning.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_Warning.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_Warning.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_Warning.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_Warning.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_Warning.common().flags().IS_KEY(false); // Doesn't apply - mel_Warning.common().flags().IS_DEFAULT(false); - mel_Warning.common().value(value++); - MD5 Warning_hash("Warning"); - for (int i = 0; i < 4; ++i) - { - mel_Warning.detail().name_hash()[i] = Warning_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_Warning); - - MinimalEnumeratedLiteral mel_Error; - mel_Error.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_Error.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_Error.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_Error.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_Error.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_Error.common().flags().IS_KEY(false); // Doesn't apply - mel_Error.common().flags().IS_DEFAULT(false); - mel_Error.common().value(value++); - MD5 Error_hash("Error"); - for (int i = 0; i < 4; ++i) - { - mel_Error.detail().name_hash()[i] = Error_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_Error); - - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().enumerated_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("Kind", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("Kind", false); -} - -const TypeObject* GetCompleteKindObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("Kind", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_ENUM); - - // No flags apply - //type_object->complete().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->complete().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->complete().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->complete().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - type_object->complete().enumerated_type().header().detail().type_name("Kind"); - - uint32_t value = 0; - CompleteEnumeratedLiteral cel_Info; - cel_Info.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_Info.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_Info.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_Info.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_Info.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_Info.common().flags().IS_KEY(false); // Doesn't apply - cel_Info.common().flags().IS_DEFAULT(false); - cel_Info.common().value(value++); - cel_Info.detail().name("Info"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_Info); - - CompleteEnumeratedLiteral cel_Warning; - cel_Warning.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_Warning.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_Warning.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_Warning.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_Warning.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_Warning.common().flags().IS_KEY(false); // Doesn't apply - cel_Warning.common().flags().IS_DEFAULT(false); - cel_Warning.common().value(value++); - cel_Warning.detail().name("Warning"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_Warning); - - CompleteEnumeratedLiteral cel_Error; - cel_Error.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_Error.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_Error.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_Error.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_Error.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_Error.common().flags().IS_KEY(false); // Doesn't apply - cel_Error.common().flags().IS_DEFAULT(false); - cel_Error.common().value(value++); - cel_Error.detail().name("Error"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_Error); - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().enumerated_type(), - current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("Kind", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("Kind", true); -} - -const TypeIdentifier* GetLogEntryIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("LogEntry", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetLogEntryObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("LogEntry", complete); -} - -const TypeObject* GetLogEntryObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("LogEntry", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteLogEntryObject(); - } - //else - return GetMinimalLogEntryObject(); -} - -const TypeObject* GetMinimalLogEntryObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("LogEntry", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_event; - mst_event.common().member_id(memberId++); - mst_event.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_event.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_event.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_event.common().member_flags().IS_OPTIONAL(false); - mst_event.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_event.common().member_flags().IS_KEY(true); - mst_event.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_event.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - MD5 event_hash("event"); - for (int i = 0; i < 4; ++i) - { - mst_event.detail().name_hash()[i] = event_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_event); - - MinimalStructMember mst_kind; - mst_kind.common().member_id(memberId++); - mst_kind.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_kind.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_kind.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_kind.common().member_flags().IS_OPTIONAL(false); - mst_kind.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_kind.common().member_flags().IS_KEY(false); - mst_kind.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_kind.common().member_type_id(*GetKindIdentifier(false)); - - MD5 kind_hash("kind"); - for (int i = 0; i < 4; ++i) - { - mst_kind.detail().name_hash()[i] = kind_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_kind); - - MinimalStructMember mst_category; - mst_category.common().member_id(memberId++); - mst_category.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_category.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_category.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_category.common().member_flags().IS_OPTIONAL(false); - mst_category.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_category.common().member_flags().IS_KEY(false); - mst_category.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_category.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 category_hash("category"); - for (int i = 0; i < 4; ++i) - { - mst_category.detail().name_hash()[i] = category_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_category); - - MinimalStructMember mst_message; - mst_message.common().member_id(memberId++); - mst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_message.common().member_flags().IS_OPTIONAL(false); - mst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_message.common().member_flags().IS_KEY(false); - mst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 message_hash("message"); - for (int i = 0; i < 4; ++i) - { - mst_message.detail().name_hash()[i] = message_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_message); - - MinimalStructMember mst_timestamp; - mst_timestamp.common().member_id(memberId++); - mst_timestamp.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_timestamp.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_timestamp.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_timestamp.common().member_flags().IS_OPTIONAL(false); - mst_timestamp.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_timestamp.common().member_flags().IS_KEY(false); - mst_timestamp.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_timestamp.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 timestamp_hash("timestamp"); - for (int i = 0; i < 4; ++i) - { - mst_timestamp.detail().name_hash()[i] = timestamp_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_timestamp); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("LogEntry", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("LogEntry", false); -} - -const TypeObject* GetCompleteLogEntryObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("LogEntry", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_event; - cst_event.common().member_id(memberId++); - cst_event.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_event.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_event.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_event.common().member_flags().IS_OPTIONAL(false); - cst_event.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_event.common().member_flags().IS_KEY(true); - cst_event.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_event.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - cst_event.detail().name("event"); - - { - AppliedAnnotation ann; - //ann.annotation_typeid(GetkeyIdentifier(true)); - ann.annotation_typeid(*TypeObjectFactory::get_instance()->get_type_identifier_trying_complete("key")); - { - AppliedAnnotationParameter annParam; - MD5 message_hash("value"); - for (int i = 0; i < 4; ++i) - { - annParam.paramname_hash()[i] = message_hash.digest[i]; - } - AnnotationParameterValue paramValue; - paramValue._d(TK_BOOLEAN); - paramValue.from_string("true"); - annParam.value(paramValue); - ann.param_seq().push_back(annParam); - } - - cst_event.detail().ann_custom().push_back(ann); - } - - - type_object->complete().struct_type().member_seq().emplace_back(cst_event); - - CompleteStructMember cst_kind; - cst_kind.common().member_id(memberId++); - cst_kind.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_kind.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_kind.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_kind.common().member_flags().IS_OPTIONAL(false); - cst_kind.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_kind.common().member_flags().IS_KEY(false); - cst_kind.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_kind.common().member_type_id(*GetKindIdentifier(true)); - - cst_kind.detail().name("kind"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_kind); - - CompleteStructMember cst_category; - cst_category.common().member_id(memberId++); - cst_category.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_category.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_category.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_category.common().member_flags().IS_OPTIONAL(false); - cst_category.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_category.common().member_flags().IS_KEY(false); - cst_category.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_category.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_category.detail().name("category"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_category); - - CompleteStructMember cst_message; - cst_message.common().member_id(memberId++); - cst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_message.common().member_flags().IS_OPTIONAL(false); - cst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_message.common().member_flags().IS_KEY(false); - cst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_message.detail().name("message"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_message); - - CompleteStructMember cst_timestamp; - cst_timestamp.common().member_id(memberId++); - cst_timestamp.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_timestamp.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_timestamp.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_timestamp.common().member_flags().IS_OPTIONAL(false); - cst_timestamp.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_timestamp.common().member_flags().IS_KEY(false); - cst_timestamp.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_timestamp.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_timestamp.detail().name("timestamp"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_timestamp); - - - // Header - type_object->complete().struct_type().header().detail().type_name("LogEntry"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("LogEntry", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("LogEntry", true); -} diff --git a/ddspipe_core/src/cpp/types/logging/v2/LogEntry.cxx b/ddspipe_core/src/cpp/types/logging/v2/LogEntry.cxx deleted file mode 100644 index 68891d6a..00000000 --- a/ddspipe_core/src/cpp/types/logging/v2/LogEntry.cxx +++ /dev/null @@ -1,289 +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 LogEntry.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#if FASTCDR_VERSION_MAJOR > 1 - -#include - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -LogEntry::LogEntry() -{ - // Just to register all known types - registerLogEntryTypes(); -} - -LogEntry::~LogEntry() -{ -} - -LogEntry::LogEntry( - const LogEntry& x) -{ - m_event = x.m_event; - m_kind = x.m_kind; - m_category = x.m_category; - m_message = x.m_message; - m_timestamp = x.m_timestamp; -} - -LogEntry::LogEntry( - LogEntry&& x) noexcept -{ - m_event = x.m_event; - m_kind = x.m_kind; - m_category = std::move(x.m_category); - m_message = std::move(x.m_message); - m_timestamp = std::move(x.m_timestamp); -} - -LogEntry& LogEntry::operator =( - const LogEntry& x) -{ - - m_event = x.m_event; - m_kind = x.m_kind; - m_category = x.m_category; - m_message = x.m_message; - m_timestamp = x.m_timestamp; - return *this; -} - -LogEntry& LogEntry::operator =( - LogEntry&& x) noexcept -{ - - m_event = x.m_event; - m_kind = x.m_kind; - m_category = std::move(x.m_category); - m_message = std::move(x.m_message); - m_timestamp = std::move(x.m_timestamp); - return *this; -} - -bool LogEntry::operator ==( - const LogEntry& x) const -{ - return (m_event == x.m_event && - m_kind == x.m_kind && - m_category == x.m_category && - m_message == x.m_message && - m_timestamp == x.m_timestamp); -} - -bool LogEntry::operator !=( - const LogEntry& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member event - * @param _event New value for member event - */ -void LogEntry::event( - int32_t _event) -{ - m_event = _event; -} - -/*! - * @brief This function returns the value of member event - * @return Value of member event - */ -int32_t LogEntry::event() const -{ - return m_event; -} - -/*! - * @brief This function returns a reference to member event - * @return Reference to member event - */ -int32_t& LogEntry::event() -{ - return m_event; -} - -/*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ -void LogEntry::kind( - Kind _kind) -{ - m_kind = _kind; -} - -/*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ -Kind LogEntry::kind() const -{ - return m_kind; -} - -/*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ -Kind& LogEntry::kind() -{ - return m_kind; -} - -/*! - * @brief This function copies the value in member category - * @param _category New value to be copied in member category - */ -void LogEntry::category( - const std::string& _category) -{ - m_category = _category; -} - -/*! - * @brief This function moves the value in member category - * @param _category New value to be moved in member category - */ -void LogEntry::category( - std::string&& _category) -{ - m_category = std::move(_category); -} - -/*! - * @brief This function returns a constant reference to member category - * @return Constant reference to member category - */ -const std::string& LogEntry::category() const -{ - return m_category; -} - -/*! - * @brief This function returns a reference to member category - * @return Reference to member category - */ -std::string& LogEntry::category() -{ - return m_category; -} - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void LogEntry::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void LogEntry::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& LogEntry::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& LogEntry::message() -{ - return m_message; -} - -/*! - * @brief This function copies the value in member timestamp - * @param _timestamp New value to be copied in member timestamp - */ -void LogEntry::timestamp( - const std::string& _timestamp) -{ - m_timestamp = _timestamp; -} - -/*! - * @brief This function moves the value in member timestamp - * @param _timestamp New value to be moved in member timestamp - */ -void LogEntry::timestamp( - std::string&& _timestamp) -{ - m_timestamp = std::move(_timestamp); -} - -/*! - * @brief This function returns a constant reference to member timestamp - * @return Constant reference to member timestamp - */ -const std::string& LogEntry::timestamp() const -{ - return m_timestamp; -} - -/*! - * @brief This function returns a reference to member timestamp - * @return Reference to member timestamp - */ -std::string& LogEntry::timestamp() -{ - return m_timestamp; -} - -// Include auxiliary functions like for serializing/deserializing. -#include - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/src/cpp/types/logging/v2/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/v2/LogEntryPubSubTypes.cxx deleted file mode 100644 index 47fa1f4c..00000000 --- a/ddspipe_core/src/cpp/types/logging/v2/LogEntryPubSubTypes.cxx +++ /dev/null @@ -1,230 +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 LogEntryPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#include - -#include -#include - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; -using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - - - - - - - - - - -LogEntryPubSubType::LogEntryPubSubType() -{ - setName("LogEntry"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(LogEntry::getMaxCdrSerializedSize()); -#else - LogEntry_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = LogEntry_max_key_cdr_typesize > 16 ? LogEntry_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -LogEntryPubSubType::~LogEntryPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool LogEntryPubSubType::serialize( - void* data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - LogEntry* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool LogEntryPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - LogEntry* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function LogEntryPubSubType::getSerializedSizeProvider( - void* data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* LogEntryPubSubType::createData() -{ - return reinterpret_cast(new LogEntry()); -} - -void LogEntryPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool LogEntryPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - LogEntry* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - LogEntry_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || LogEntry_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/src/cpp/types/logging/v2/LogEntryTypeObject.cxx b/ddspipe_core/src/cpp/types/logging/v2/LogEntryTypeObject.cxx deleted file mode 100644 index 229dac58..00000000 --- a/ddspipe_core/src/cpp/types/logging/v2/LogEntryTypeObject.cxx +++ /dev/null @@ -1,622 +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 LogEntryTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // ifdef _WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerLogEntryTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory* factory = TypeObjectFactory::get_instance(); - factory->add_type_object("Kind", GetKindIdentifier(true), - GetKindObject(true)); - factory->add_type_object("Kind", GetKindIdentifier(false), - GetKindObject(false)); - - - factory->add_type_object("LogEntry", GetLogEntryIdentifier(true), - GetLogEntryObject(true)); - factory->add_type_object("LogEntry", GetLogEntryIdentifier(false), - GetLogEntryObject(false)); - - }); -} - -const TypeIdentifier* GetKindIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("Kind", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetKindObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("Kind", complete); -} - -const TypeObject* GetKindObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("Kind", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteKindObject(); - } - // else - return GetMinimalKindObject(); -} - -const TypeObject* GetMinimalKindObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("Kind", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_ENUM); - - // No flags apply - //type_object->minimal().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->minimal().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->minimal().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->minimal().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - - uint32_t value = 0; - MinimalEnumeratedLiteral mel_Info; - mel_Info.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_Info.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_Info.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_Info.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_Info.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_Info.common().flags().IS_KEY(false); // Doesn't apply - mel_Info.common().flags().IS_DEFAULT(false); - mel_Info.common().value(value++); - MD5 Info_hash("Info"); - for (int i = 0; i < 4; ++i) - { - mel_Info.detail().name_hash()[i] = Info_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_Info); - - MinimalEnumeratedLiteral mel_Warning; - mel_Warning.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_Warning.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_Warning.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_Warning.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_Warning.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_Warning.common().flags().IS_KEY(false); // Doesn't apply - mel_Warning.common().flags().IS_DEFAULT(false); - mel_Warning.common().value(value++); - MD5 Warning_hash("Warning"); - for (int i = 0; i < 4; ++i) - { - mel_Warning.detail().name_hash()[i] = Warning_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_Warning); - - MinimalEnumeratedLiteral mel_Error; - mel_Error.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_Error.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_Error.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_Error.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_Error.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_Error.common().flags().IS_KEY(false); // Doesn't apply - mel_Error.common().flags().IS_DEFAULT(false); - mel_Error.common().value(value++); - MD5 Error_hash("Error"); - for (int i = 0; i < 4; ++i) - { - mel_Error.detail().name_hash()[i] = Error_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_Error); - - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().enumerated_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("Kind", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("Kind", false); -} - -const TypeObject* GetCompleteKindObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("Kind", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_ENUM); - - // No flags apply - //type_object->complete().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->complete().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->complete().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->complete().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - type_object->complete().enumerated_type().header().detail().type_name("Kind"); - - uint32_t value = 0; - CompleteEnumeratedLiteral cel_Info; - cel_Info.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_Info.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_Info.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_Info.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_Info.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_Info.common().flags().IS_KEY(false); // Doesn't apply - cel_Info.common().flags().IS_DEFAULT(false); - cel_Info.common().value(value++); - cel_Info.detail().name("Info"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_Info); - - CompleteEnumeratedLiteral cel_Warning; - cel_Warning.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_Warning.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_Warning.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_Warning.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_Warning.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_Warning.common().flags().IS_KEY(false); // Doesn't apply - cel_Warning.common().flags().IS_DEFAULT(false); - cel_Warning.common().value(value++); - cel_Warning.detail().name("Warning"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_Warning); - - CompleteEnumeratedLiteral cel_Error; - cel_Error.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_Error.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_Error.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_Error.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_Error.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_Error.common().flags().IS_KEY(false); // Doesn't apply - cel_Error.common().flags().IS_DEFAULT(false); - cel_Error.common().value(value++); - cel_Error.detail().name("Error"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_Error); - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().enumerated_type(), - current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("Kind", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("Kind", true); -} - -const TypeIdentifier* GetLogEntryIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("LogEntry", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetLogEntryObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("LogEntry", complete); -} - -const TypeObject* GetLogEntryObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("LogEntry", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteLogEntryObject(); - } - //else - return GetMinimalLogEntryObject(); -} - -const TypeObject* GetMinimalLogEntryObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("LogEntry", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_event; - mst_event.common().member_id(memberId++); - mst_event.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_event.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_event.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_event.common().member_flags().IS_OPTIONAL(false); - mst_event.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_event.common().member_flags().IS_KEY(true); - mst_event.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_event.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - MD5 event_hash("event"); - for (int i = 0; i < 4; ++i) - { - mst_event.detail().name_hash()[i] = event_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_event); - - MinimalStructMember mst_kind; - mst_kind.common().member_id(memberId++); - mst_kind.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_kind.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_kind.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_kind.common().member_flags().IS_OPTIONAL(false); - mst_kind.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_kind.common().member_flags().IS_KEY(false); - mst_kind.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_kind.common().member_type_id(*GetKindIdentifier(false)); - - MD5 kind_hash("kind"); - for (int i = 0; i < 4; ++i) - { - mst_kind.detail().name_hash()[i] = kind_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_kind); - - MinimalStructMember mst_category; - mst_category.common().member_id(memberId++); - mst_category.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_category.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_category.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_category.common().member_flags().IS_OPTIONAL(false); - mst_category.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_category.common().member_flags().IS_KEY(false); - mst_category.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_category.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 category_hash("category"); - for (int i = 0; i < 4; ++i) - { - mst_category.detail().name_hash()[i] = category_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_category); - - MinimalStructMember mst_message; - mst_message.common().member_id(memberId++); - mst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_message.common().member_flags().IS_OPTIONAL(false); - mst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_message.common().member_flags().IS_KEY(false); - mst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 message_hash("message"); - for (int i = 0; i < 4; ++i) - { - mst_message.detail().name_hash()[i] = message_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_message); - - MinimalStructMember mst_timestamp; - mst_timestamp.common().member_id(memberId++); - mst_timestamp.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_timestamp.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_timestamp.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_timestamp.common().member_flags().IS_OPTIONAL(false); - mst_timestamp.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_timestamp.common().member_flags().IS_KEY(false); - mst_timestamp.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_timestamp.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 timestamp_hash("timestamp"); - for (int i = 0; i < 4; ++i) - { - mst_timestamp.detail().name_hash()[i] = timestamp_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_timestamp); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("LogEntry", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("LogEntry", false); -} - -const TypeObject* GetCompleteLogEntryObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("LogEntry", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_event; - cst_event.common().member_id(memberId++); - cst_event.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_event.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_event.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_event.common().member_flags().IS_OPTIONAL(false); - cst_event.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_event.common().member_flags().IS_KEY(true); - cst_event.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_event.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - cst_event.detail().name("event"); - - { - AppliedAnnotation ann; - //ann.annotation_typeid(GetkeyIdentifier(true)); - ann.annotation_typeid(*TypeObjectFactory::get_instance()->get_type_identifier_trying_complete("key")); - { - AppliedAnnotationParameter annParam; - MD5 message_hash("value"); - for (int i = 0; i < 4; ++i) - { - annParam.paramname_hash()[i] = message_hash.digest[i]; - } - AnnotationParameterValue paramValue; - paramValue._d(TK_BOOLEAN); - paramValue.from_string("true"); - annParam.value(paramValue); - ann.param_seq().push_back(annParam); - } - - cst_event.detail().ann_custom().push_back(ann); - } - - - type_object->complete().struct_type().member_seq().emplace_back(cst_event); - - CompleteStructMember cst_kind; - cst_kind.common().member_id(memberId++); - cst_kind.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_kind.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_kind.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_kind.common().member_flags().IS_OPTIONAL(false); - cst_kind.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_kind.common().member_flags().IS_KEY(false); - cst_kind.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_kind.common().member_type_id(*GetKindIdentifier(true)); - - cst_kind.detail().name("kind"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_kind); - - CompleteStructMember cst_category; - cst_category.common().member_id(memberId++); - cst_category.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_category.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_category.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_category.common().member_flags().IS_OPTIONAL(false); - cst_category.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_category.common().member_flags().IS_KEY(false); - cst_category.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_category.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_category.detail().name("category"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_category); - - CompleteStructMember cst_message; - cst_message.common().member_id(memberId++); - cst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_message.common().member_flags().IS_OPTIONAL(false); - cst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_message.common().member_flags().IS_KEY(false); - cst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_message.detail().name("message"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_message); - - CompleteStructMember cst_timestamp; - cst_timestamp.common().member_id(memberId++); - cst_timestamp.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_timestamp.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_timestamp.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_timestamp.common().member_flags().IS_OPTIONAL(false); - cst_timestamp.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_timestamp.common().member_flags().IS_KEY(false); - cst_timestamp.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_timestamp.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_timestamp.detail().name("timestamp"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_timestamp); - - - // Header - type_object->complete().struct_type().header().detail().type_name("LogEntry"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("LogEntry", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("LogEntry", true); -} diff --git a/ddspipe_core/src/cpp/types/logging/v2/LogEntryv1.cxx b/ddspipe_core/src/cpp/types/logging/v2/LogEntryv1.cxx deleted file mode 100644 index 079deb03..00000000 --- a/ddspipe_core/src/cpp/types/logging/v2/LogEntryv1.cxx +++ /dev/null @@ -1,480 +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 LogEntry.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#include - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { -namespace internal { - -enum class Size -{ - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size( - int s) -{ - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH -{ - using type = std::uint8_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint16_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint32_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint64_t; -}; -} // namespace internal - -template -struct FindType -{ - using type = typename internal::FindTypeH::type; -}; -} // namespace helper - -#define LogEntry_max_cdr_typesize 792ULL; - - - - -LogEntry::LogEntry() -{ - // long m_event - m_event = 0; - // Kind m_kind - m_kind = ::Info; - // /type_d() m_category - - // /type_d() m_message - - // /type_d() m_timestamp - - - // Just to register all known types - registerLogEntryTypes(); -} - -LogEntry::~LogEntry() -{ -} - -LogEntry::LogEntry( - const LogEntry& x) -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = x.m_category; - - - m_message = x.m_message; - - - m_timestamp = x.m_timestamp; - -} - -LogEntry::LogEntry( - LogEntry&& x) noexcept -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = std::move(x.m_category); - - - m_message = std::move(x.m_message); - - - m_timestamp = std::move(x.m_timestamp); - -} - -LogEntry& LogEntry::operator =( - const LogEntry& x) -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = x.m_category; - - - m_message = x.m_message; - - - m_timestamp = x.m_timestamp; - - return *this; -} - -LogEntry& LogEntry::operator =( - LogEntry&& x) noexcept -{ - m_event = x.m_event; - - - m_kind = x.m_kind; - - - m_category = std::move(x.m_category); - - - m_message = std::move(x.m_message); - - - m_timestamp = std::move(x.m_timestamp); - - return *this; -} - -bool LogEntry::operator ==( - const LogEntry& x) const -{ - return (m_event == x.m_event && - m_kind == x.m_kind && - m_category == x.m_category && - m_message == x.m_message && - m_timestamp == x.m_timestamp); -} - -bool LogEntry::operator !=( - const LogEntry& x) const -{ - return !(*this == x); -} - -size_t LogEntry::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return LogEntry_max_cdr_typesize; -} - -size_t LogEntry::getCdrSerializedSize( - const LogEntry& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.category().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.timestamp().size() + 1; - - - return current_alignment - initial_alignment; -} - -void LogEntry::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_event; - - scdr << (uint32_t)m_kind; - - scdr << m_category.c_str(); - - scdr << m_message.c_str(); - - scdr << m_timestamp.c_str(); - -} - -void LogEntry::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_event; - - - - { - uint32_t enum_value = 0; - dcdr >> enum_value; - m_kind = (Kind)enum_value; - } - - - - dcdr >> m_category; - - - - dcdr >> m_message; - - - - dcdr >> m_timestamp; - - -} - -bool LogEntry::isKeyDefined() -{ - return true; -} - -void LogEntry::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - - scdr << m_event; - - - - - -} - -/*! - * @brief This function sets a value in member event - * @param _event New value for member event - */ -void LogEntry::event( - int32_t _event) -{ - m_event = _event; -} - -/*! - * @brief This function returns the value of member event - * @return Value of member event - */ -int32_t LogEntry::event() const -{ - return m_event; -} - -/*! - * @brief This function returns a reference to member event - * @return Reference to member event - */ -int32_t& LogEntry::event() -{ - return m_event; -} - -/*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ -void LogEntry::kind( - Kind _kind) -{ - m_kind = _kind; -} - -/*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ -Kind LogEntry::kind() const -{ - return m_kind; -} - -/*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ -Kind& LogEntry::kind() -{ - return m_kind; -} - -/*! - * @brief This function copies the value in member category - * @param _category New value to be copied in member category - */ -void LogEntry::category( - const std::string& _category) -{ - m_category = _category; -} - -/*! - * @brief This function moves the value in member category - * @param _category New value to be moved in member category - */ -void LogEntry::category( - std::string&& _category) -{ - m_category = std::move(_category); -} - -/*! - * @brief This function returns a constant reference to member category - * @return Constant reference to member category - */ -const std::string& LogEntry::category() const -{ - return m_category; -} - -/*! - * @brief This function returns a reference to member category - * @return Reference to member category - */ -std::string& LogEntry::category() -{ - return m_category; -} - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void LogEntry::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void LogEntry::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& LogEntry::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& LogEntry::message() -{ - return m_message; -} - -/*! - * @brief This function copies the value in member timestamp - * @param _timestamp New value to be copied in member timestamp - */ -void LogEntry::timestamp( - const std::string& _timestamp) -{ - m_timestamp = _timestamp; -} - -/*! - * @brief This function moves the value in member timestamp - * @param _timestamp New value to be moved in member timestamp - */ -void LogEntry::timestamp( - std::string&& _timestamp) -{ - m_timestamp = std::move(_timestamp); -} - -/*! - * @brief This function returns a constant reference to member timestamp - * @return Constant reference to member timestamp - */ -const std::string& LogEntry::timestamp() const -{ - return m_timestamp; -} - -/*! - * @brief This function returns a reference to member timestamp - * @return Reference to member timestamp - */ -std::string& LogEntry::timestamp() -{ - return m_timestamp; -} - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx similarity index 90% rename from ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatusPubSubTypes.cxx rename to ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx index e17cde95..27d724e3 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatusPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx @@ -19,32 +19,31 @@ * This file was generated by the tool fastddsgen. */ +#include +#include #include -#include -#include +#include +#include using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - MonitoringErrorStatusPubSubType::MonitoringErrorStatusPubSubType() { setName("MonitoringErrorStatus"); uint32_t type_size = #if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringErrorStatus::getMaxCdrSerializedSize()); + static_cast(MonitoringErrorStatus::getMaxCdrSerializedSize()); #else - MonitoringErrorStatus_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 + MonitoringErrorStatus_max_cdr_typesize; +#endif type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ m_typeSize = type_size + 4; /*encapsulation*/ m_isGetKeyDefined = false; - uint32_t keyLength = MonitoringErrorStatus_max_key_cdr_typesize > - 16 ? MonitoringErrorStatus_max_key_cdr_typesize : 16; + uint32_t keyLength = MonitoringErrorStatus_max_key_cdr_typesize > 16 ? MonitoringErrorStatus_max_key_cdr_typesize : 16; m_keyBuffer = reinterpret_cast(malloc(keyLength)); memset(m_keyBuffer, 0, keyLength); } @@ -151,8 +150,8 @@ std::function MonitoringErrorStatusPubSubType::getSerializedSizeProv 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*/; + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) { @@ -190,8 +189,7 @@ bool MonitoringErrorStatusPubSubType::getKey( MonitoringErrorStatus_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::XCDRv1); #if FASTCDR_VERSION_MAJOR == 1 p_type->serializeKey(ser); #else @@ -221,15 +219,20 @@ bool MonitoringErrorStatusPubSubType::getKey( return true; } +void MonitoringErrorStatusPubSubType::register_type_object_representation() const +{ + register_MonitoringStatus_type_objects(); +} + MonitoringStatusPubSubType::MonitoringStatusPubSubType() { setName("MonitoringStatus"); uint32_t type_size = #if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringStatus::getMaxCdrSerializedSize()); + static_cast(MonitoringStatus::getMaxCdrSerializedSize()); #else - MonitoringStatus_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 + MonitoringStatus_max_cdr_typesize; +#endif type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ m_typeSize = type_size + 4; /*encapsulation*/ m_isGetKeyDefined = false; @@ -340,8 +343,8 @@ std::function MonitoringStatusPubSubType::getSerializedSizeProvider( 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*/; + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) { @@ -379,8 +382,7 @@ bool MonitoringStatusPubSubType::getKey( MonitoringStatus_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::XCDRv1); #if FASTCDR_VERSION_MAJOR == 1 p_type->serializeKey(ser); #else @@ -409,3 +411,12 @@ bool MonitoringStatusPubSubType::getKey( } return true; } + +void MonitoringStatusPubSubType::register_type_object_representation() const +{ + register_MonitoringStatus_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx new file mode 100644 index 00000000..ece4358d --- /dev/null +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx @@ -0,0 +1,527 @@ +// 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 MonitoringStatusTypeObjectSupport.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. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_MonitoringStatus_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_MonitoringErrorStatus_type_identifier(); + + register_MonitoringStatus_type_identifier(); + + }); +} + +void register_MonitoringErrorStatus_type_identifier() +{ + { + StructTypeFlag struct_flags_MonitoringErrorStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_MonitoringErrorStatus; + TypeIdentifierPair type_ids_MonitoringErrorStatus; + QualifiedTypeName type_name_MonitoringErrorStatus = "MonitoringErrorStatus"; + eprosima::fastcdr::optional type_ann_builtin_MonitoringErrorStatus; + eprosima::fastcdr::optional ann_custom_MonitoringErrorStatus; + CompleteTypeDetail detail_MonitoringErrorStatus = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MonitoringErrorStatus, ann_custom_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string()); + CompleteStructHeader header_MonitoringErrorStatus; + header_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringErrorStatus); + CompleteStructMemberSeq member_seq_MonitoringErrorStatus; + { + return_code_MonitoringErrorStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_MonitoringErrorStatus); + + if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_mismatch; + MemberId member_id_type_mismatch = 0x00000000; + if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_mismatch = "type_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_type_mismatch; + ann_custom_MonitoringErrorStatus.reset(); + CompleteMemberDetail detail_type_mismatch = TypeObjectUtils::build_complete_member_detail(name_type_mismatch, member_ann_builtin_type_mismatch, ann_custom_MonitoringErrorStatus); + CompleteStructMember member_type_mismatch = TypeObjectUtils::build_complete_struct_member(common_type_mismatch, detail_type_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringErrorStatus, member_type_mismatch); + } + { + return_code_MonitoringErrorStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_MonitoringErrorStatus); + + if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_qos_mismatch; + MemberId member_id_qos_mismatch = 0x00000001; + if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure qos_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_qos_mismatch = "qos_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_qos_mismatch; + ann_custom_MonitoringErrorStatus.reset(); + CompleteMemberDetail detail_qos_mismatch = TypeObjectUtils::build_complete_member_detail(name_qos_mismatch, member_ann_builtin_qos_mismatch, ann_custom_MonitoringErrorStatus); + CompleteStructMember member_qos_mismatch = TypeObjectUtils::build_complete_struct_member(common_qos_mismatch, detail_qos_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringErrorStatus, member_qos_mismatch); + } + CompleteStructType struct_type_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringErrorStatus, header_MonitoringErrorStatus, member_seq_MonitoringErrorStatus); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringErrorStatus already registered in TypeObjectRegistry for a different type."); + } + return_code_MonitoringErrorStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringErrorStatus", type_ids_MonitoringErrorStatus); + if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringErrorStatus: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_MonitoringStatus_type_identifier() +{ + { + StructTypeFlag struct_flags_MonitoringStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_MonitoringStatus; + TypeIdentifierPair type_ids_MonitoringStatus; + QualifiedTypeName type_name_MonitoringStatus = "MonitoringStatus"; + eprosima::fastcdr::optional type_ann_builtin_MonitoringStatus; + eprosima::fastcdr::optional ann_custom_MonitoringStatus; + CompleteTypeDetail detail_MonitoringStatus = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MonitoringStatus, ann_custom_MonitoringStatus, type_name_MonitoringStatus.to_string()); + CompleteStructHeader header_MonitoringStatus; + header_MonitoringStatus = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringStatus); + CompleteStructMemberSeq member_seq_MonitoringStatus; + { + return_code_MonitoringStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringErrorStatus", type_ids_MonitoringStatus); + + if (return_code_MonitoringStatus != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_MonitoringErrorStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_MonitoringErrorStatus; + TypeIdentifierPair type_ids_MonitoringErrorStatus; + QualifiedTypeName type_name_MonitoringErrorStatus = "MonitoringErrorStatus"; + eprosima::fastcdr::optional type_ann_builtin_MonitoringErrorStatus; + eprosima::fastcdr::optional ann_custom_MonitoringErrorStatus; + CompleteTypeDetail detail_MonitoringErrorStatus = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MonitoringErrorStatus, ann_custom_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string()); + CompleteStructHeader header_MonitoringErrorStatus; + header_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringErrorStatus); + CompleteStructMemberSeq member_seq_MonitoringErrorStatus; + { + return_code_MonitoringErrorStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_MonitoringErrorStatus); + + if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_mismatch; + MemberId member_id_type_mismatch = 0x00000000; + if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_mismatch = "type_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_type_mismatch; + ann_custom_MonitoringErrorStatus.reset(); + CompleteMemberDetail detail_type_mismatch = TypeObjectUtils::build_complete_member_detail(name_type_mismatch, member_ann_builtin_type_mismatch, ann_custom_MonitoringErrorStatus); + CompleteStructMember member_type_mismatch = TypeObjectUtils::build_complete_struct_member(common_type_mismatch, detail_type_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringErrorStatus, member_type_mismatch); + } + { + return_code_MonitoringErrorStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_MonitoringErrorStatus); + + if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_qos_mismatch; + MemberId member_id_qos_mismatch = 0x00000001; + if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure qos_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_qos_mismatch = "qos_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_qos_mismatch; + ann_custom_MonitoringErrorStatus.reset(); + CompleteMemberDetail detail_qos_mismatch = TypeObjectUtils::build_complete_member_detail(name_qos_mismatch, member_ann_builtin_qos_mismatch, ann_custom_MonitoringErrorStatus); + CompleteStructMember member_qos_mismatch = TypeObjectUtils::build_complete_struct_member(common_qos_mismatch, detail_qos_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringErrorStatus, member_qos_mismatch); + } + CompleteStructType struct_type_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringErrorStatus, header_MonitoringErrorStatus, member_seq_MonitoringErrorStatus); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringErrorStatus already registered in TypeObjectRegistry for a different type."); + } + return_code_MonitoringErrorStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringErrorStatus", type_ids_MonitoringErrorStatus); + if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringErrorStatus: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_error_status = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_error_status; + MemberId member_id_error_status = 0x00000000; + if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, member_flags_error_status, type_ids_MonitoringStatus.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, member_flags_error_status, type_ids_MonitoringStatus.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure error_status member TypeIdentifier inconsistent."); + return; + } + MemberName name_error_status = "error_status"; + eprosima::fastcdr::optional member_ann_builtin_error_status; + ann_custom_MonitoringStatus.reset(); + CompleteMemberDetail detail_error_status = TypeObjectUtils::build_complete_member_detail(name_error_status, member_ann_builtin_error_status, ann_custom_MonitoringStatus); + CompleteStructMember member_error_status = TypeObjectUtils::build_complete_struct_member(common_error_status, detail_error_status); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringStatus, member_error_status); + } + { + return_code_MonitoringStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_MonitoringStatus); + + if (return_code_MonitoringStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "has_errors Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_has_errors = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_has_errors; + MemberId member_id_has_errors = 0x00000001; + if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, member_flags_has_errors, type_ids_MonitoringStatus.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, member_flags_has_errors, type_ids_MonitoringStatus.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure has_errors member TypeIdentifier inconsistent."); + return; + } + MemberName name_has_errors = "has_errors"; + eprosima::fastcdr::optional member_ann_builtin_has_errors; + ann_custom_MonitoringStatus.reset(); + CompleteMemberDetail detail_has_errors = TypeObjectUtils::build_complete_member_detail(name_has_errors, member_ann_builtin_has_errors, ann_custom_MonitoringStatus); + CompleteStructMember member_has_errors = TypeObjectUtils::build_complete_struct_member(common_has_errors, detail_has_errors); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringStatus, member_has_errors); + } + CompleteStructType struct_type_MonitoringStatus = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringStatus, header_MonitoringStatus, member_seq_MonitoringStatus); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringStatus, type_name_MonitoringStatus.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringStatus already registered in TypeObjectRegistry for a different type."); + } + return_code_MonitoringStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringStatus", type_ids_MonitoringStatus); + if (return_code_MonitoringStatus != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringStatus: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatus.cxx b/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatus.cxx deleted file mode 100644 index e6811fe5..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatus.cxx +++ /dev/null @@ -1,465 +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 MonitoringStatus.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { -namespace internal { - -enum class Size -{ - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size( - int s) -{ - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH -{ - using type = std::uint8_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint16_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint32_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint64_t; -}; -} // namespace internal - -template -struct FindType -{ - using type = typename internal::FindTypeH::type; -}; -} // namespace helper - -#define MonitoringErrorStatus_max_cdr_typesize 6ULL; -#define MonitoringStatus_max_cdr_typesize 11ULL; - - - - -MonitoringErrorStatus::MonitoringErrorStatus() -{ - // boolean m_type_mismatch - m_type_mismatch = false; - // boolean m_qos_mismatch - m_qos_mismatch = false; - -} - -MonitoringErrorStatus::~MonitoringErrorStatus() -{ -} - -MonitoringErrorStatus::MonitoringErrorStatus( - const MonitoringErrorStatus& x) -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - -} - -MonitoringErrorStatus::MonitoringErrorStatus( - MonitoringErrorStatus&& x) noexcept -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - -} - -MonitoringErrorStatus& MonitoringErrorStatus::operator =( - const MonitoringErrorStatus& x) -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - return *this; -} - -MonitoringErrorStatus& MonitoringErrorStatus::operator =( - MonitoringErrorStatus&& x) noexcept -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - return *this; -} - -bool MonitoringErrorStatus::operator ==( - const MonitoringErrorStatus& x) const -{ - return (m_type_mismatch == x.m_type_mismatch && - m_qos_mismatch == x.m_qos_mismatch); -} - -bool MonitoringErrorStatus::operator !=( - const MonitoringErrorStatus& x) const -{ - return !(*this == x); -} - -size_t MonitoringErrorStatus::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return MonitoringErrorStatus_max_cdr_typesize; -} - -size_t MonitoringErrorStatus::getCdrSerializedSize( - const MonitoringErrorStatus& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - return current_alignment - initial_alignment; -} - -void MonitoringErrorStatus::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_type_mismatch; - - scdr << m_qos_mismatch; - -} - -void MonitoringErrorStatus::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_type_mismatch; - - - - dcdr >> m_qos_mismatch; - - -} - -bool MonitoringErrorStatus::isKeyDefined() -{ - return false; -} - -void MonitoringErrorStatus::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ -void MonitoringErrorStatus::type_mismatch( - bool _type_mismatch) -{ - m_type_mismatch = _type_mismatch; -} - -/*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ -bool MonitoringErrorStatus::type_mismatch() const -{ - return m_type_mismatch; -} - -/*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ -bool& MonitoringErrorStatus::type_mismatch() -{ - return m_type_mismatch; -} - -/*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ -void MonitoringErrorStatus::qos_mismatch( - bool _qos_mismatch) -{ - m_qos_mismatch = _qos_mismatch; -} - -/*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ -bool MonitoringErrorStatus::qos_mismatch() const -{ - return m_qos_mismatch; -} - -/*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ -bool& MonitoringErrorStatus::qos_mismatch() -{ - return m_qos_mismatch; -} - -MonitoringStatus::MonitoringStatus() -{ - // MonitoringErrorStatus m_error_status - - // boolean m_has_errors - m_has_errors = false; - -} - -MonitoringStatus::~MonitoringStatus() -{ -} - -MonitoringStatus::MonitoringStatus( - const MonitoringStatus& x) -{ - m_error_status = x.m_error_status; - - - m_has_errors = x.m_has_errors; - -} - -MonitoringStatus::MonitoringStatus( - MonitoringStatus&& x) noexcept -{ - m_error_status = std::move(x.m_error_status); - - - m_has_errors = x.m_has_errors; - -} - -MonitoringStatus& MonitoringStatus::operator =( - const MonitoringStatus& x) -{ - m_error_status = x.m_error_status; - - - m_has_errors = x.m_has_errors; - - return *this; -} - -MonitoringStatus& MonitoringStatus::operator =( - MonitoringStatus&& x) noexcept -{ - m_error_status = std::move(x.m_error_status); - - - m_has_errors = x.m_has_errors; - - return *this; -} - -bool MonitoringStatus::operator ==( - const MonitoringStatus& x) const -{ - return (m_error_status == x.m_error_status && - m_has_errors == x.m_has_errors); -} - -bool MonitoringStatus::operator !=( - const MonitoringStatus& x) const -{ - return !(*this == x); -} - -size_t MonitoringStatus::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return MonitoringStatus_max_cdr_typesize; -} - -size_t MonitoringStatus::getCdrSerializedSize( - const MonitoringStatus& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += MonitoringErrorStatus::getCdrSerializedSize(data.error_status(), current_alignment); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - return current_alignment - initial_alignment; -} - -void MonitoringStatus::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_error_status; - - scdr << m_has_errors; - -} - -void MonitoringStatus::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_error_status; - - - - dcdr >> m_has_errors; - - -} - -bool MonitoringStatus::isKeyDefined() -{ - return false; -} - -void MonitoringStatus::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member error_status - * @param _error_status New value to be copied in member error_status - */ -void MonitoringStatus::error_status( - const MonitoringErrorStatus& _error_status) -{ - m_error_status = _error_status; -} - -/*! - * @brief This function moves the value in member error_status - * @param _error_status New value to be moved in member error_status - */ -void MonitoringStatus::error_status( - MonitoringErrorStatus&& _error_status) -{ - m_error_status = std::move(_error_status); -} - -/*! - * @brief This function returns a constant reference to member error_status - * @return Constant reference to member error_status - */ -const MonitoringErrorStatus& MonitoringStatus::error_status() const -{ - return m_error_status; -} - -/*! - * @brief This function returns a reference to member error_status - * @return Reference to member error_status - */ -MonitoringErrorStatus& MonitoringStatus::error_status() -{ - return m_error_status; -} - -/*! - * @brief This function sets a value in member has_errors - * @param _has_errors New value for member has_errors - */ -void MonitoringStatus::has_errors( - bool _has_errors) -{ - m_has_errors = _has_errors; -} - -/*! - * @brief This function returns the value of member has_errors - * @return Value of member has_errors - */ -bool MonitoringStatus::has_errors() const -{ - return m_has_errors; -} - -/*! - * @brief This function returns a reference to member has_errors - * @return Reference to member has_errors - */ -bool& MonitoringStatus::has_errors() -{ - return m_has_errors; -} diff --git a/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatusTypeObject.cxx b/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatusTypeObject.cxx deleted file mode 100644 index ff7465d1..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/status/v1/MonitoringStatusTypeObject.cxx +++ /dev/null @@ -1,487 +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 MonitoringStatusTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // ifdef _WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerMonitoringStatusTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory* factory = TypeObjectFactory::get_instance(); - factory->add_type_object("MonitoringErrorStatus", GetMonitoringErrorStatusIdentifier(true), - GetMonitoringErrorStatusObject(true)); - factory->add_type_object("MonitoringErrorStatus", GetMonitoringErrorStatusIdentifier(false), - GetMonitoringErrorStatusObject(false)); - - - factory->add_type_object("MonitoringStatus", GetMonitoringStatusIdentifier(true), - GetMonitoringStatusObject(true)); - factory->add_type_object("MonitoringStatus", GetMonitoringStatusIdentifier(false), - GetMonitoringStatusObject(false)); - - }); -} - -const TypeIdentifier* GetMonitoringErrorStatusIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MonitoringErrorStatus", - complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMonitoringErrorStatusObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("MonitoringErrorStatus", complete); -} - -const TypeObject* GetMonitoringErrorStatusObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", - complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMonitoringErrorStatusObject(); - } - //else - return GetMinimalMonitoringErrorStatusObject(); -} - -const TypeObject* GetMinimalMonitoringErrorStatusObject() -{ - const TypeObject* c_type_object = - TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_type_mismatch; - mst_type_mismatch.common().member_id(memberId++); - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_mismatch.common().member_flags().IS_KEY(false); - mst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 type_mismatch_hash("type_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_type_mismatch.detail().name_hash()[i] = type_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_mismatch); - - MinimalStructMember mst_qos_mismatch; - mst_qos_mismatch.common().member_id(memberId++); - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_qos_mismatch.common().member_flags().IS_KEY(false); - mst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 qos_mismatch_hash("qos_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_qos_mismatch.detail().name_hash()[i] = qos_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_qos_mismatch); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringErrorStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", false); -} - -const TypeObject* GetCompleteMonitoringErrorStatusObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_type_mismatch; - cst_type_mismatch.common().member_id(memberId++); - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_mismatch.common().member_flags().IS_KEY(false); - cst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_type_mismatch.detail().name("type_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_mismatch); - - CompleteStructMember cst_qos_mismatch; - cst_qos_mismatch.common().member_id(memberId++); - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_qos_mismatch.common().member_flags().IS_KEY(false); - cst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_qos_mismatch.detail().name("qos_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_qos_mismatch); - - - // Header - type_object->complete().struct_type().header().detail().type_name("MonitoringErrorStatus"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringErrorStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", true); -} - -const TypeIdentifier* GetMonitoringStatusIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MonitoringStatus", - complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMonitoringStatusObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("MonitoringStatus", complete); -} - -const TypeObject* GetMonitoringStatusObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMonitoringStatusObject(); - } - //else - return GetMinimalMonitoringStatusObject(); -} - -const TypeObject* GetMinimalMonitoringStatusObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_error_status; - mst_error_status.common().member_id(memberId++); - mst_error_status.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_error_status.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_error_status.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_error_status.common().member_flags().IS_OPTIONAL(false); - mst_error_status.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_error_status.common().member_flags().IS_KEY(false); - mst_error_status.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_error_status.common().member_type_id(*GetMonitoringErrorStatusIdentifier(false)); - - MD5 error_status_hash("error_status"); - for (int i = 0; i < 4; ++i) - { - mst_error_status.detail().name_hash()[i] = error_status_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_error_status); - - MinimalStructMember mst_has_errors; - mst_has_errors.common().member_id(memberId++); - mst_has_errors.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_has_errors.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_has_errors.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_has_errors.common().member_flags().IS_OPTIONAL(false); - mst_has_errors.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_has_errors.common().member_flags().IS_KEY(false); - mst_has_errors.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_has_errors.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 has_errors_hash("has_errors"); - for (int i = 0; i < 4; ++i) - { - mst_has_errors.detail().name_hash()[i] = has_errors_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_has_errors); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", false); -} - -const TypeObject* GetCompleteMonitoringStatusObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_error_status; - cst_error_status.common().member_id(memberId++); - cst_error_status.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_error_status.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_error_status.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_error_status.common().member_flags().IS_OPTIONAL(false); - cst_error_status.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_error_status.common().member_flags().IS_KEY(false); - cst_error_status.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_error_status.common().member_type_id(*GetMonitoringErrorStatusIdentifier(true)); - - cst_error_status.detail().name("error_status"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_error_status); - - CompleteStructMember cst_has_errors; - cst_has_errors.common().member_id(memberId++); - cst_has_errors.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_has_errors.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_has_errors.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_has_errors.common().member_flags().IS_OPTIONAL(false); - cst_has_errors.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_has_errors.common().member_flags().IS_KEY(false); - cst_has_errors.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_has_errors.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_has_errors.detail().name("has_errors"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_has_errors); - - - // Header - type_object->complete().struct_type().header().detail().type_name("MonitoringStatus"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", true); -} diff --git a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatus.cxx b/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatus.cxx deleted file mode 100644 index a2e9028c..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatus.cxx +++ /dev/null @@ -1,275 +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 MonitoringStatus.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#if FASTCDR_VERSION_MAJOR > 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -MonitoringErrorStatus::MonitoringErrorStatus() -{ -} - -MonitoringErrorStatus::~MonitoringErrorStatus() -{ -} - -MonitoringErrorStatus::MonitoringErrorStatus( - const MonitoringErrorStatus& x) -{ - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; -} - -MonitoringErrorStatus::MonitoringErrorStatus( - MonitoringErrorStatus&& x) noexcept -{ - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; -} - -MonitoringErrorStatus& MonitoringErrorStatus::operator =( - const MonitoringErrorStatus& x) -{ - - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; - return *this; -} - -MonitoringErrorStatus& MonitoringErrorStatus::operator =( - MonitoringErrorStatus&& x) noexcept -{ - - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; - return *this; -} - -bool MonitoringErrorStatus::operator ==( - const MonitoringErrorStatus& x) const -{ - return (m_type_mismatch == x.m_type_mismatch && - m_qos_mismatch == x.m_qos_mismatch); -} - -bool MonitoringErrorStatus::operator !=( - const MonitoringErrorStatus& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ -void MonitoringErrorStatus::type_mismatch( - bool _type_mismatch) -{ - m_type_mismatch = _type_mismatch; -} - -/*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ -bool MonitoringErrorStatus::type_mismatch() const -{ - return m_type_mismatch; -} - -/*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ -bool& MonitoringErrorStatus::type_mismatch() -{ - return m_type_mismatch; -} - -/*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ -void MonitoringErrorStatus::qos_mismatch( - bool _qos_mismatch) -{ - m_qos_mismatch = _qos_mismatch; -} - -/*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ -bool MonitoringErrorStatus::qos_mismatch() const -{ - return m_qos_mismatch; -} - -/*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ -bool& MonitoringErrorStatus::qos_mismatch() -{ - return m_qos_mismatch; -} - -MonitoringStatus::MonitoringStatus() -{ -} - -MonitoringStatus::~MonitoringStatus() -{ -} - -MonitoringStatus::MonitoringStatus( - const MonitoringStatus& x) -{ - m_error_status = x.m_error_status; - m_has_errors = x.m_has_errors; -} - -MonitoringStatus::MonitoringStatus( - MonitoringStatus&& x) noexcept -{ - m_error_status = std::move(x.m_error_status); - m_has_errors = x.m_has_errors; -} - -MonitoringStatus& MonitoringStatus::operator =( - const MonitoringStatus& x) -{ - - m_error_status = x.m_error_status; - m_has_errors = x.m_has_errors; - return *this; -} - -MonitoringStatus& MonitoringStatus::operator =( - MonitoringStatus&& x) noexcept -{ - - m_error_status = std::move(x.m_error_status); - m_has_errors = x.m_has_errors; - return *this; -} - -bool MonitoringStatus::operator ==( - const MonitoringStatus& x) const -{ - return (m_error_status == x.m_error_status && - m_has_errors == x.m_has_errors); -} - -bool MonitoringStatus::operator !=( - const MonitoringStatus& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member error_status - * @param _error_status New value to be copied in member error_status - */ -void MonitoringStatus::error_status( - const MonitoringErrorStatus& _error_status) -{ - m_error_status = _error_status; -} - -/*! - * @brief This function moves the value in member error_status - * @param _error_status New value to be moved in member error_status - */ -void MonitoringStatus::error_status( - MonitoringErrorStatus&& _error_status) -{ - m_error_status = std::move(_error_status); -} - -/*! - * @brief This function returns a constant reference to member error_status - * @return Constant reference to member error_status - */ -const MonitoringErrorStatus& MonitoringStatus::error_status() const -{ - return m_error_status; -} - -/*! - * @brief This function returns a reference to member error_status - * @return Reference to member error_status - */ -MonitoringErrorStatus& MonitoringStatus::error_status() -{ - return m_error_status; -} - -/*! - * @brief This function sets a value in member has_errors - * @param _has_errors New value for member has_errors - */ -void MonitoringStatus::has_errors( - bool _has_errors) -{ - m_has_errors = _has_errors; -} - -/*! - * @brief This function returns the value of member has_errors - * @return Value of member has_errors - */ -bool MonitoringStatus::has_errors() const -{ - return m_has_errors; -} - -/*! - * @brief This function returns a reference to member has_errors - * @return Reference to member has_errors - */ -bool& MonitoringStatus::has_errors() -{ - return m_has_errors; -} - -// Include auxiliary functions like for serializing/deserializing. -#include - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusPubSubTypes.cxx deleted file mode 100644 index b287587d..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusPubSubTypes.cxx +++ /dev/null @@ -1,411 +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 MonitoringStatusPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#include - -#include -#include - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; -using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - -MonitoringErrorStatusPubSubType::MonitoringErrorStatusPubSubType() -{ - setName("MonitoringErrorStatus"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringErrorStatus::getMaxCdrSerializedSize()); -#else - MonitoringErrorStatus_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = MonitoringErrorStatus_max_key_cdr_typesize > - 16 ? MonitoringErrorStatus_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -MonitoringErrorStatusPubSubType::~MonitoringErrorStatusPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool MonitoringErrorStatusPubSubType::serialize( - void* data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - MonitoringErrorStatus* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool MonitoringErrorStatusPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - MonitoringErrorStatus* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function MonitoringErrorStatusPubSubType::getSerializedSizeProvider( - void* data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* MonitoringErrorStatusPubSubType::createData() -{ - return reinterpret_cast(new MonitoringErrorStatus()); -} - -void MonitoringErrorStatusPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool MonitoringErrorStatusPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - MonitoringErrorStatus* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - MonitoringErrorStatus_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || MonitoringErrorStatus_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -MonitoringStatusPubSubType::MonitoringStatusPubSubType() -{ - setName("MonitoringStatus"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringStatus::getMaxCdrSerializedSize()); -#else - MonitoringStatus_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = MonitoringStatus_max_key_cdr_typesize > 16 ? MonitoringStatus_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -MonitoringStatusPubSubType::~MonitoringStatusPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool MonitoringStatusPubSubType::serialize( - void* data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - MonitoringStatus* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool MonitoringStatusPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - MonitoringStatus* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function MonitoringStatusPubSubType::getSerializedSizeProvider( - void* data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* MonitoringStatusPubSubType::createData() -{ - return reinterpret_cast(new MonitoringStatus()); -} - -void MonitoringStatusPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool MonitoringStatusPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - MonitoringStatus* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - MonitoringStatus_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || MonitoringStatus_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusTypeObject.cxx b/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusTypeObject.cxx deleted file mode 100644 index 25259815..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusTypeObject.cxx +++ /dev/null @@ -1,487 +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 MonitoringStatusTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // ifdef _WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerMonitoringStatusTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory* factory = TypeObjectFactory::get_instance(); - factory->add_type_object("MonitoringErrorStatus", GetMonitoringErrorStatusIdentifier(true), - GetMonitoringErrorStatusObject(true)); - factory->add_type_object("MonitoringErrorStatus", GetMonitoringErrorStatusIdentifier(false), - GetMonitoringErrorStatusObject(false)); - - - factory->add_type_object("MonitoringStatus", GetMonitoringStatusIdentifier(true), - GetMonitoringStatusObject(true)); - factory->add_type_object("MonitoringStatus", GetMonitoringStatusIdentifier(false), - GetMonitoringStatusObject(false)); - - }); -} - -const TypeIdentifier* GetMonitoringErrorStatusIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MonitoringErrorStatus", - complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMonitoringErrorStatusObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("MonitoringErrorStatus", complete); -} - -const TypeObject* GetMonitoringErrorStatusObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", - complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMonitoringErrorStatusObject(); - } - //else - return GetMinimalMonitoringErrorStatusObject(); -} - -const TypeObject* GetMinimalMonitoringErrorStatusObject() -{ - const TypeObject* c_type_object = - TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_type_mismatch; - mst_type_mismatch.common().member_id(memberId++); - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_mismatch.common().member_flags().IS_KEY(false); - mst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 type_mismatch_hash("type_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_type_mismatch.detail().name_hash()[i] = type_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_mismatch); - - MinimalStructMember mst_qos_mismatch; - mst_qos_mismatch.common().member_id(memberId++); - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_qos_mismatch.common().member_flags().IS_KEY(false); - mst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 qos_mismatch_hash("qos_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_qos_mismatch.detail().name_hash()[i] = qos_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_qos_mismatch); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringErrorStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", false); -} - -const TypeObject* GetCompleteMonitoringErrorStatusObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_type_mismatch; - cst_type_mismatch.common().member_id(memberId++); - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_mismatch.common().member_flags().IS_KEY(false); - cst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_type_mismatch.detail().name("type_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_mismatch); - - CompleteStructMember cst_qos_mismatch; - cst_qos_mismatch.common().member_id(memberId++); - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_qos_mismatch.common().member_flags().IS_KEY(false); - cst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_qos_mismatch.detail().name("qos_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_qos_mismatch); - - - // Header - type_object->complete().struct_type().header().detail().type_name("MonitoringErrorStatus"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringErrorStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringErrorStatus", true); -} - -const TypeIdentifier* GetMonitoringStatusIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MonitoringStatus", - complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMonitoringStatusObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("MonitoringStatus", complete); -} - -const TypeObject* GetMonitoringStatusObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMonitoringStatusObject(); - } - //else - return GetMinimalMonitoringStatusObject(); -} - -const TypeObject* GetMinimalMonitoringStatusObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_error_status; - mst_error_status.common().member_id(memberId++); - mst_error_status.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_error_status.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_error_status.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_error_status.common().member_flags().IS_OPTIONAL(false); - mst_error_status.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_error_status.common().member_flags().IS_KEY(false); - mst_error_status.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_error_status.common().member_type_id(*GetMonitoringErrorStatusIdentifier(false)); - - MD5 error_status_hash("error_status"); - for (int i = 0; i < 4; ++i) - { - mst_error_status.detail().name_hash()[i] = error_status_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_error_status); - - MinimalStructMember mst_has_errors; - mst_has_errors.common().member_id(memberId++); - mst_has_errors.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_has_errors.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_has_errors.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_has_errors.common().member_flags().IS_OPTIONAL(false); - mst_has_errors.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_has_errors.common().member_flags().IS_KEY(false); - mst_has_errors.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_has_errors.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 has_errors_hash("has_errors"); - for (int i = 0; i < 4; ++i) - { - mst_has_errors.detail().name_hash()[i] = has_errors_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_has_errors); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", false); -} - -const TypeObject* GetCompleteMonitoringStatusObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_error_status; - cst_error_status.common().member_id(memberId++); - cst_error_status.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_error_status.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_error_status.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_error_status.common().member_flags().IS_OPTIONAL(false); - cst_error_status.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_error_status.common().member_flags().IS_KEY(false); - cst_error_status.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_error_status.common().member_type_id(*GetMonitoringErrorStatusIdentifier(true)); - - cst_error_status.detail().name("error_status"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_error_status); - - CompleteStructMember cst_has_errors; - cst_has_errors.common().member_id(memberId++); - cst_has_errors.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_has_errors.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_has_errors.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_has_errors.common().member_flags().IS_OPTIONAL(false); - cst_has_errors.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_has_errors.common().member_flags().IS_KEY(false); - cst_has_errors.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_has_errors.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_has_errors.detail().name("has_errors"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_has_errors); - - - // Header - type_object->complete().struct_type().header().detail().type_name("MonitoringStatus"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringStatus", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringStatus", true); -} diff --git a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusv1.cxx b/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusv1.cxx deleted file mode 100644 index 49f2422f..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/status/v2/MonitoringStatusv1.cxx +++ /dev/null @@ -1,469 +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 MonitoringStatus.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { -namespace internal { - -enum class Size -{ - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size( - int s) -{ - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH -{ - using type = std::uint8_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint16_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint32_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint64_t; -}; -} // namespace internal - -template -struct FindType -{ - using type = typename internal::FindTypeH::type; -}; -} // namespace helper - -#define MonitoringErrorStatus_max_cdr_typesize 6ULL; -#define MonitoringStatus_max_cdr_typesize 11ULL; - - - - -MonitoringErrorStatus::MonitoringErrorStatus() -{ - // boolean m_type_mismatch - m_type_mismatch = false; - // boolean m_qos_mismatch - m_qos_mismatch = false; - -} - -MonitoringErrorStatus::~MonitoringErrorStatus() -{ -} - -MonitoringErrorStatus::MonitoringErrorStatus( - const MonitoringErrorStatus& x) -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - -} - -MonitoringErrorStatus::MonitoringErrorStatus( - MonitoringErrorStatus&& x) noexcept -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - -} - -MonitoringErrorStatus& MonitoringErrorStatus::operator =( - const MonitoringErrorStatus& x) -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - return *this; -} - -MonitoringErrorStatus& MonitoringErrorStatus::operator =( - MonitoringErrorStatus&& x) noexcept -{ - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - return *this; -} - -bool MonitoringErrorStatus::operator ==( - const MonitoringErrorStatus& x) const -{ - return (m_type_mismatch == x.m_type_mismatch && - m_qos_mismatch == x.m_qos_mismatch); -} - -bool MonitoringErrorStatus::operator !=( - const MonitoringErrorStatus& x) const -{ - return !(*this == x); -} - -size_t MonitoringErrorStatus::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return MonitoringErrorStatus_max_cdr_typesize; -} - -size_t MonitoringErrorStatus::getCdrSerializedSize( - const MonitoringErrorStatus& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - return current_alignment - initial_alignment; -} - -void MonitoringErrorStatus::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_type_mismatch; - - scdr << m_qos_mismatch; - -} - -void MonitoringErrorStatus::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_type_mismatch; - - - - dcdr >> m_qos_mismatch; - - -} - -bool MonitoringErrorStatus::isKeyDefined() -{ - return false; -} - -void MonitoringErrorStatus::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ -void MonitoringErrorStatus::type_mismatch( - bool _type_mismatch) -{ - m_type_mismatch = _type_mismatch; -} - -/*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ -bool MonitoringErrorStatus::type_mismatch() const -{ - return m_type_mismatch; -} - -/*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ -bool& MonitoringErrorStatus::type_mismatch() -{ - return m_type_mismatch; -} - -/*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ -void MonitoringErrorStatus::qos_mismatch( - bool _qos_mismatch) -{ - m_qos_mismatch = _qos_mismatch; -} - -/*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ -bool MonitoringErrorStatus::qos_mismatch() const -{ - return m_qos_mismatch; -} - -/*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ -bool& MonitoringErrorStatus::qos_mismatch() -{ - return m_qos_mismatch; -} - -MonitoringStatus::MonitoringStatus() -{ - // MonitoringErrorStatus m_error_status - - // boolean m_has_errors - m_has_errors = false; - -} - -MonitoringStatus::~MonitoringStatus() -{ -} - -MonitoringStatus::MonitoringStatus( - const MonitoringStatus& x) -{ - m_error_status = x.m_error_status; - - - m_has_errors = x.m_has_errors; - -} - -MonitoringStatus::MonitoringStatus( - MonitoringStatus&& x) noexcept -{ - m_error_status = std::move(x.m_error_status); - - - m_has_errors = x.m_has_errors; - -} - -MonitoringStatus& MonitoringStatus::operator =( - const MonitoringStatus& x) -{ - m_error_status = x.m_error_status; - - - m_has_errors = x.m_has_errors; - - return *this; -} - -MonitoringStatus& MonitoringStatus::operator =( - MonitoringStatus&& x) noexcept -{ - m_error_status = std::move(x.m_error_status); - - - m_has_errors = x.m_has_errors; - - return *this; -} - -bool MonitoringStatus::operator ==( - const MonitoringStatus& x) const -{ - return (m_error_status == x.m_error_status && - m_has_errors == x.m_has_errors); -} - -bool MonitoringStatus::operator !=( - const MonitoringStatus& x) const -{ - return !(*this == x); -} - -size_t MonitoringStatus::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return MonitoringStatus_max_cdr_typesize; -} - -size_t MonitoringStatus::getCdrSerializedSize( - const MonitoringStatus& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += MonitoringErrorStatus::getCdrSerializedSize(data.error_status(), current_alignment); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - return current_alignment - initial_alignment; -} - -void MonitoringStatus::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_error_status; - - scdr << m_has_errors; - -} - -void MonitoringStatus::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_error_status; - - - - dcdr >> m_has_errors; - - -} - -bool MonitoringStatus::isKeyDefined() -{ - return false; -} - -void MonitoringStatus::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member error_status - * @param _error_status New value to be copied in member error_status - */ -void MonitoringStatus::error_status( - const MonitoringErrorStatus& _error_status) -{ - m_error_status = _error_status; -} - -/*! - * @brief This function moves the value in member error_status - * @param _error_status New value to be moved in member error_status - */ -void MonitoringStatus::error_status( - MonitoringErrorStatus&& _error_status) -{ - m_error_status = std::move(_error_status); -} - -/*! - * @brief This function returns a constant reference to member error_status - * @return Constant reference to member error_status - */ -const MonitoringErrorStatus& MonitoringStatus::error_status() const -{ - return m_error_status; -} - -/*! - * @brief This function returns a reference to member error_status - * @return Reference to member error_status - */ -MonitoringErrorStatus& MonitoringStatus::error_status() -{ - return m_error_status; -} - -/*! - * @brief This function sets a value in member has_errors - * @param _has_errors New value for member has_errors - */ -void MonitoringStatus::has_errors( - bool _has_errors) -{ - m_has_errors = _has_errors; -} - -/*! - * @brief This function returns the value of member has_errors - * @return Value of member has_errors - */ -bool MonitoringStatus::has_errors() const -{ - return m_has_errors; -} - -/*! - * @brief This function returns a reference to member has_errors - * @return Reference to member has_errors - */ -bool& MonitoringStatus::has_errors() -{ - return m_has_errors; -} - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx similarity index 91% rename from ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopicsPubSubTypes.cxx rename to ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx index 46e85f1d..e83fa85e 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopicsPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx @@ -19,27 +19,27 @@ * This file was generated by the tool fastddsgen. */ +#include +#include #include -#include -#include +#include +#include using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - DdsTopicDataPubSubType::DdsTopicDataPubSubType() { setName("DdsTopicData"); uint32_t type_size = #if FASTCDR_VERSION_MAJOR == 1 - static_cast(DdsTopicData::getMaxCdrSerializedSize()); + static_cast(DdsTopicData::getMaxCdrSerializedSize()); #else - DdsTopicData_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 + DdsTopicData_max_cdr_typesize; +#endif type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ m_typeSize = type_size + 4; /*encapsulation*/ m_isGetKeyDefined = false; @@ -150,8 +150,8 @@ std::function DdsTopicDataPubSubType::getSerializedSizeProvider( 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*/; + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) { @@ -189,8 +189,7 @@ bool DdsTopicDataPubSubType::getKey( DdsTopicData_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::XCDRv1); #if FASTCDR_VERSION_MAJOR == 1 p_type->serializeKey(ser); #else @@ -220,15 +219,20 @@ bool DdsTopicDataPubSubType::getKey( return true; } +void DdsTopicDataPubSubType::register_type_object_representation() const +{ + register_MonitoringTopics_type_objects(); +} + DdsTopicPubSubType::DdsTopicPubSubType() { setName("DdsTopic"); uint32_t type_size = #if FASTCDR_VERSION_MAJOR == 1 - static_cast(DdsTopic::getMaxCdrSerializedSize()); + static_cast(DdsTopic::getMaxCdrSerializedSize()); #else - DdsTopic_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 + DdsTopic_max_cdr_typesize; +#endif type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ m_typeSize = type_size + 4; /*encapsulation*/ m_isGetKeyDefined = false; @@ -339,8 +343,8 @@ std::function DdsTopicPubSubType::getSerializedSizeProvider( 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*/; + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) { @@ -378,8 +382,7 @@ bool DdsTopicPubSubType::getKey( DdsTopic_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::XCDRv1); #if FASTCDR_VERSION_MAJOR == 1 p_type->serializeKey(ser); #else @@ -409,15 +412,20 @@ bool DdsTopicPubSubType::getKey( return true; } +void DdsTopicPubSubType::register_type_object_representation() const +{ + register_MonitoringTopics_type_objects(); +} + MonitoringTopicsPubSubType::MonitoringTopicsPubSubType() { setName("MonitoringTopics"); uint32_t type_size = #if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringTopics::getMaxCdrSerializedSize()); + static_cast(MonitoringTopics::getMaxCdrSerializedSize()); #else - MonitoringTopics_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 + MonitoringTopics_max_cdr_typesize; +#endif type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ m_typeSize = type_size + 4; /*encapsulation*/ m_isGetKeyDefined = false; @@ -528,8 +536,8 @@ std::function MonitoringTopicsPubSubType::getSerializedSizeProvider( 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*/; + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) { @@ -567,8 +575,7 @@ bool MonitoringTopicsPubSubType::getKey( MonitoringTopics_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::XCDRv1); #if FASTCDR_VERSION_MAJOR == 1 p_type->serializeKey(ser); #else @@ -597,3 +604,12 @@ bool MonitoringTopicsPubSubType::getKey( } return true; } + +void MonitoringTopicsPubSubType::register_type_object_representation() const +{ + register_MonitoringTopics_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx new file mode 100644 index 00000000..671d45a8 --- /dev/null +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx @@ -0,0 +1,2361 @@ +// 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 MonitoringTopicsTypeObjectSupport.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. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_MonitoringTopics_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_DdsTopicData_type_identifier(); + + register_DdsTopic_type_identifier(); + + register_MonitoringTopics_type_identifier(); + + }); +} + +void register_DdsTopicData_type_identifier() +{ + { + StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_DdsTopicData; + TypeIdentifierPair type_ids_DdsTopicData; + QualifiedTypeName type_name_DdsTopicData = "DdsTopicData"; + eprosima::fastcdr::optional type_ann_builtin_DdsTopicData; + eprosima::fastcdr::optional ann_custom_DdsTopicData; + CompleteTypeDetail detail_DdsTopicData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopicData, ann_custom_DdsTopicData, type_name_DdsTopicData.to_string()); + CompleteStructHeader header_DdsTopicData; + header_DdsTopicData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopicData); + CompleteStructMemberSeq member_seq_DdsTopicData; + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopicData); + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_participant_id; + MemberId member_id_participant_id = 0x00000000; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure participant_id member TypeIdentifier inconsistent."); + return; + } + MemberName name_participant_id = "participant_id"; + eprosima::fastcdr::optional member_ann_builtin_participant_id; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_participant_id = TypeObjectUtils::build_complete_member_detail(name_participant_id, member_ann_builtin_participant_id, ann_custom_DdsTopicData); + CompleteStructMember member_participant_id = TypeObjectUtils::build_complete_struct_member(common_participant_id, detail_participant_id); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_participant_id); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msgs_lost Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msgs_lost; + MemberId member_id_msgs_lost = 0x00000001; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msgs_lost member TypeIdentifier inconsistent."); + return; + } + MemberName name_msgs_lost = "msgs_lost"; + eprosima::fastcdr::optional member_ann_builtin_msgs_lost; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msgs_lost = TypeObjectUtils::build_complete_member_detail(name_msgs_lost, member_ann_builtin_msgs_lost, ann_custom_DdsTopicData); + CompleteStructMember member_msgs_lost = TypeObjectUtils::build_complete_struct_member(common_msgs_lost, detail_msgs_lost); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_lost); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msgs_received Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msgs_received; + MemberId member_id_msgs_received = 0x00000002; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msgs_received member TypeIdentifier inconsistent."); + return; + } + MemberName name_msgs_received = "msgs_received"; + eprosima::fastcdr::optional member_ann_builtin_msgs_received; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msgs_received = TypeObjectUtils::build_complete_member_detail(name_msgs_received, member_ann_builtin_msgs_received, ann_custom_DdsTopicData); + CompleteStructMember member_msgs_received = TypeObjectUtils::build_complete_struct_member(common_msgs_received, detail_msgs_received); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_received); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msg_rx_rate Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msg_rx_rate; + MemberId member_id_msg_rx_rate = 0x00000003; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msg_rx_rate member TypeIdentifier inconsistent."); + return; + } + MemberName name_msg_rx_rate = "msg_rx_rate"; + eprosima::fastcdr::optional member_ann_builtin_msg_rx_rate; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msg_rx_rate = TypeObjectUtils::build_complete_member_detail(name_msg_rx_rate, member_ann_builtin_msg_rx_rate, ann_custom_DdsTopicData); + CompleteStructMember member_msg_rx_rate = TypeObjectUtils::build_complete_struct_member(common_msg_rx_rate, detail_msg_rx_rate); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msg_rx_rate); + } + CompleteStructType struct_type_DdsTopicData = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopicData, header_DdsTopicData, member_seq_DdsTopicData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopicData, type_name_DdsTopicData.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopicData already registered in TypeObjectRegistry for a different type."); + } + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopicData", type_ids_DdsTopicData); + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopicData: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_DdsTopic_type_identifier() +{ + { + StructTypeFlag struct_flags_DdsTopic = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_DdsTopic; + TypeIdentifierPair type_ids_DdsTopic; + QualifiedTypeName type_name_DdsTopic = "DdsTopic"; + eprosima::fastcdr::optional type_ann_builtin_DdsTopic; + eprosima::fastcdr::optional ann_custom_DdsTopic; + CompleteTypeDetail detail_DdsTopic = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopic, ann_custom_DdsTopic, type_name_DdsTopic.to_string()); + CompleteStructHeader header_DdsTopic; + header_DdsTopic = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopic); + CompleteStructMemberSeq member_seq_DdsTopic; + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_name; + MemberId member_id_name = 0x00000000; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure name member TypeIdentifier inconsistent."); + return; + } + MemberName name_name = "name"; + eprosima::fastcdr::optional member_ann_builtin_name; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_name = TypeObjectUtils::build_complete_member_detail(name_name, member_ann_builtin_name, ann_custom_DdsTopic); + CompleteStructMember member_name = TypeObjectUtils::build_complete_struct_member(common_name, detail_name); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_name); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_type_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_name; + MemberId member_id_type_name = 0x00000001; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_name member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_name = "type_name"; + eprosima::fastcdr::optional member_ann_builtin_type_name; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_type_name = TypeObjectUtils::build_complete_member_detail(name_type_name, member_ann_builtin_type_name, ann_custom_DdsTopic); + CompleteStructMember member_type_name = TypeObjectUtils::build_complete_struct_member(common_type_name, detail_type_name); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_name); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "type_discovered Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_type_discovered = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_discovered; + MemberId member_id_type_discovered = 0x00000002; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_discovered member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_discovered = "type_discovered"; + eprosima::fastcdr::optional member_ann_builtin_type_discovered; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_type_discovered = TypeObjectUtils::build_complete_member_detail(name_type_discovered, member_ann_builtin_type_discovered, ann_custom_DdsTopic); + CompleteStructMember member_type_discovered = TypeObjectUtils::build_complete_struct_member(common_type_discovered, detail_type_discovered); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_discovered); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_mismatch; + MemberId member_id_type_mismatch = 0x00000003; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_mismatch = "type_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_type_mismatch; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_type_mismatch = TypeObjectUtils::build_complete_member_detail(name_type_mismatch, member_ann_builtin_type_mismatch, ann_custom_DdsTopic); + CompleteStructMember member_type_mismatch = TypeObjectUtils::build_complete_struct_member(common_type_mismatch, detail_type_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_mismatch); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_qos_mismatch; + MemberId member_id_qos_mismatch = 0x00000004; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure qos_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_qos_mismatch = "qos_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_qos_mismatch; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_qos_mismatch = TypeObjectUtils::build_complete_member_detail(name_qos_mismatch, member_ann_builtin_qos_mismatch, ann_custom_DdsTopic); + CompleteStructMember member_qos_mismatch = TypeObjectUtils::build_complete_struct_member(common_qos_mismatch, detail_qos_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_qos_mismatch); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopicData", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_DdsTopicData; + TypeIdentifierPair type_ids_DdsTopicData; + QualifiedTypeName type_name_DdsTopicData = "DdsTopicData"; + eprosima::fastcdr::optional type_ann_builtin_DdsTopicData; + eprosima::fastcdr::optional ann_custom_DdsTopicData; + CompleteTypeDetail detail_DdsTopicData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopicData, ann_custom_DdsTopicData, type_name_DdsTopicData.to_string()); + CompleteStructHeader header_DdsTopicData; + header_DdsTopicData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopicData); + CompleteStructMemberSeq member_seq_DdsTopicData; + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopicData); + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_participant_id; + MemberId member_id_participant_id = 0x00000000; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure participant_id member TypeIdentifier inconsistent."); + return; + } + MemberName name_participant_id = "participant_id"; + eprosima::fastcdr::optional member_ann_builtin_participant_id; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_participant_id = TypeObjectUtils::build_complete_member_detail(name_participant_id, member_ann_builtin_participant_id, ann_custom_DdsTopicData); + CompleteStructMember member_participant_id = TypeObjectUtils::build_complete_struct_member(common_participant_id, detail_participant_id); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_participant_id); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msgs_lost Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msgs_lost; + MemberId member_id_msgs_lost = 0x00000001; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msgs_lost member TypeIdentifier inconsistent."); + return; + } + MemberName name_msgs_lost = "msgs_lost"; + eprosima::fastcdr::optional member_ann_builtin_msgs_lost; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msgs_lost = TypeObjectUtils::build_complete_member_detail(name_msgs_lost, member_ann_builtin_msgs_lost, ann_custom_DdsTopicData); + CompleteStructMember member_msgs_lost = TypeObjectUtils::build_complete_struct_member(common_msgs_lost, detail_msgs_lost); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_lost); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msgs_received Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msgs_received; + MemberId member_id_msgs_received = 0x00000002; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msgs_received member TypeIdentifier inconsistent."); + return; + } + MemberName name_msgs_received = "msgs_received"; + eprosima::fastcdr::optional member_ann_builtin_msgs_received; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msgs_received = TypeObjectUtils::build_complete_member_detail(name_msgs_received, member_ann_builtin_msgs_received, ann_custom_DdsTopicData); + CompleteStructMember member_msgs_received = TypeObjectUtils::build_complete_struct_member(common_msgs_received, detail_msgs_received); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_received); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msg_rx_rate Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msg_rx_rate; + MemberId member_id_msg_rx_rate = 0x00000003; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msg_rx_rate member TypeIdentifier inconsistent."); + return; + } + MemberName name_msg_rx_rate = "msg_rx_rate"; + eprosima::fastcdr::optional member_ann_builtin_msg_rx_rate; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msg_rx_rate = TypeObjectUtils::build_complete_member_detail(name_msg_rx_rate, member_ann_builtin_msg_rx_rate, ann_custom_DdsTopicData); + CompleteStructMember member_msg_rx_rate = TypeObjectUtils::build_complete_struct_member(common_msg_rx_rate, detail_msg_rx_rate); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msg_rx_rate); + } + CompleteStructType struct_type_DdsTopicData = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopicData, header_DdsTopicData, member_seq_DdsTopicData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopicData, type_name_DdsTopicData.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopicData already registered in TypeObjectRegistry for a different type."); + } + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopicData", type_ids_DdsTopicData); + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopicData: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_DdsTopicData_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_DdsTopic.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_DdsTopicData_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_DdsTopicData_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_DdsTopicData_unbounded, element_flags_anonymous_sequence_DdsTopicData_unbounded); + std::string type_id_kind_anonymous_sequence_DdsTopicData_unbounded("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_DdsTopicData_unbounded == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopicData_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_DdsTopicData_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopicData_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_data; + MemberId member_id_data = 0x00000005; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure data member TypeIdentifier inconsistent."); + return; + } + MemberName name_data = "data"; + eprosima::fastcdr::optional member_ann_builtin_data; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_data = TypeObjectUtils::build_complete_member_detail(name_data, member_ann_builtin_data, ann_custom_DdsTopic); + CompleteStructMember member_data = TypeObjectUtils::build_complete_struct_member(common_data, detail_data); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_data); + } + CompleteStructType struct_type_DdsTopic = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopic, header_DdsTopic, member_seq_DdsTopic); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopic, type_name_DdsTopic.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopic already registered in TypeObjectRegistry for a different type."); + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopic", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopic: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_MonitoringTopics_type_identifier() +{ + { + StructTypeFlag struct_flags_MonitoringTopics = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_MonitoringTopics; + TypeIdentifierPair type_ids_MonitoringTopics; + QualifiedTypeName type_name_MonitoringTopics = "MonitoringTopics"; + eprosima::fastcdr::optional type_ann_builtin_MonitoringTopics; + eprosima::fastcdr::optional ann_custom_MonitoringTopics; + CompleteTypeDetail detail_MonitoringTopics = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MonitoringTopics, ann_custom_MonitoringTopics, type_name_MonitoringTopics.to_string()); + CompleteStructHeader header_MonitoringTopics; + header_MonitoringTopics = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringTopics); + CompleteStructMemberSeq member_seq_MonitoringTopics; + { + return_code_MonitoringTopics = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_DdsTopic_unbounded", type_ids_MonitoringTopics); + + if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_MonitoringTopics = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopic", type_ids_MonitoringTopics); + + if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_DdsTopic = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_DdsTopic; + TypeIdentifierPair type_ids_DdsTopic; + QualifiedTypeName type_name_DdsTopic = "DdsTopic"; + eprosima::fastcdr::optional type_ann_builtin_DdsTopic; + eprosima::fastcdr::optional ann_custom_DdsTopic; + CompleteTypeDetail detail_DdsTopic = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopic, ann_custom_DdsTopic, type_name_DdsTopic.to_string()); + CompleteStructHeader header_DdsTopic; + header_DdsTopic = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopic); + CompleteStructMemberSeq member_seq_DdsTopic; + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_name; + MemberId member_id_name = 0x00000000; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure name member TypeIdentifier inconsistent."); + return; + } + MemberName name_name = "name"; + eprosima::fastcdr::optional member_ann_builtin_name; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_name = TypeObjectUtils::build_complete_member_detail(name_name, member_ann_builtin_name, ann_custom_DdsTopic); + CompleteStructMember member_name = TypeObjectUtils::build_complete_struct_member(common_name, detail_name); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_name); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_type_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_name; + MemberId member_id_type_name = 0x00000001; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_name member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_name = "type_name"; + eprosima::fastcdr::optional member_ann_builtin_type_name; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_type_name = TypeObjectUtils::build_complete_member_detail(name_type_name, member_ann_builtin_type_name, ann_custom_DdsTopic); + CompleteStructMember member_type_name = TypeObjectUtils::build_complete_struct_member(common_type_name, detail_type_name); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_name); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "type_discovered Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_type_discovered = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_discovered; + MemberId member_id_type_discovered = 0x00000002; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_discovered member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_discovered = "type_discovered"; + eprosima::fastcdr::optional member_ann_builtin_type_discovered; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_type_discovered = TypeObjectUtils::build_complete_member_detail(name_type_discovered, member_ann_builtin_type_discovered, ann_custom_DdsTopic); + CompleteStructMember member_type_discovered = TypeObjectUtils::build_complete_struct_member(common_type_discovered, detail_type_discovered); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_discovered); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_type_mismatch; + MemberId member_id_type_mismatch = 0x00000003; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure type_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_type_mismatch = "type_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_type_mismatch; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_type_mismatch = TypeObjectUtils::build_complete_member_detail(name_type_mismatch, member_ann_builtin_type_mismatch, ann_custom_DdsTopic); + CompleteStructMember member_type_mismatch = TypeObjectUtils::build_complete_struct_member(common_type_mismatch, detail_type_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_mismatch); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_qos_mismatch; + MemberId member_id_qos_mismatch = 0x00000004; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure qos_mismatch member TypeIdentifier inconsistent."); + return; + } + MemberName name_qos_mismatch = "qos_mismatch"; + eprosima::fastcdr::optional member_ann_builtin_qos_mismatch; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_qos_mismatch = TypeObjectUtils::build_complete_member_detail(name_qos_mismatch, member_ann_builtin_qos_mismatch, ann_custom_DdsTopic); + CompleteStructMember member_qos_mismatch = TypeObjectUtils::build_complete_struct_member(common_qos_mismatch, detail_qos_mismatch); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_qos_mismatch); + } + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopicData", type_ids_DdsTopic); + + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_DdsTopicData; + TypeIdentifierPair type_ids_DdsTopicData; + QualifiedTypeName type_name_DdsTopicData = "DdsTopicData"; + eprosima::fastcdr::optional type_ann_builtin_DdsTopicData; + eprosima::fastcdr::optional ann_custom_DdsTopicData; + CompleteTypeDetail detail_DdsTopicData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopicData, ann_custom_DdsTopicData, type_name_DdsTopicData.to_string()); + CompleteStructHeader header_DdsTopicData; + header_DdsTopicData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopicData); + CompleteStructMemberSeq member_seq_DdsTopicData; + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_DdsTopicData); + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_participant_id; + MemberId member_id_participant_id = 0x00000000; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure participant_id member TypeIdentifier inconsistent."); + return; + } + MemberName name_participant_id = "participant_id"; + eprosima::fastcdr::optional member_ann_builtin_participant_id; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_participant_id = TypeObjectUtils::build_complete_member_detail(name_participant_id, member_ann_builtin_participant_id, ann_custom_DdsTopicData); + CompleteStructMember member_participant_id = TypeObjectUtils::build_complete_struct_member(common_participant_id, detail_participant_id); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_participant_id); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msgs_lost Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msgs_lost; + MemberId member_id_msgs_lost = 0x00000001; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msgs_lost member TypeIdentifier inconsistent."); + return; + } + MemberName name_msgs_lost = "msgs_lost"; + eprosima::fastcdr::optional member_ann_builtin_msgs_lost; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msgs_lost = TypeObjectUtils::build_complete_member_detail(name_msgs_lost, member_ann_builtin_msgs_lost, ann_custom_DdsTopicData); + CompleteStructMember member_msgs_lost = TypeObjectUtils::build_complete_struct_member(common_msgs_lost, detail_msgs_lost); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_lost); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msgs_received Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msgs_received; + MemberId member_id_msgs_received = 0x00000002; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msgs_received member TypeIdentifier inconsistent."); + return; + } + MemberName name_msgs_received = "msgs_received"; + eprosima::fastcdr::optional member_ann_builtin_msgs_received; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msgs_received = TypeObjectUtils::build_complete_member_detail(name_msgs_received, member_ann_builtin_msgs_received, ann_custom_DdsTopicData); + CompleteStructMember member_msgs_received = TypeObjectUtils::build_complete_struct_member(common_msgs_received, detail_msgs_received); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_received); + } + { + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_DdsTopicData); + + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "msg_rx_rate Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_msg_rx_rate; + MemberId member_id_msg_rx_rate = 0x00000003; + if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure msg_rx_rate member TypeIdentifier inconsistent."); + return; + } + MemberName name_msg_rx_rate = "msg_rx_rate"; + eprosima::fastcdr::optional member_ann_builtin_msg_rx_rate; + ann_custom_DdsTopicData.reset(); + CompleteMemberDetail detail_msg_rx_rate = TypeObjectUtils::build_complete_member_detail(name_msg_rx_rate, member_ann_builtin_msg_rx_rate, ann_custom_DdsTopicData); + CompleteStructMember member_msg_rx_rate = TypeObjectUtils::build_complete_struct_member(common_msg_rx_rate, detail_msg_rx_rate); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msg_rx_rate); + } + CompleteStructType struct_type_DdsTopicData = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopicData, header_DdsTopicData, member_seq_DdsTopicData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopicData, type_name_DdsTopicData.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopicData already registered in TypeObjectRegistry for a different type."); + } + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopicData", type_ids_DdsTopicData); + if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopicData: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_DdsTopicData_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_DdsTopic.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_DdsTopicData_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_DdsTopicData_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_DdsTopicData_unbounded, element_flags_anonymous_sequence_DdsTopicData_unbounded); + std::string type_id_kind_anonymous_sequence_DdsTopicData_unbounded("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_DdsTopicData_unbounded == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopicData_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_DdsTopicData_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopicData_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_data; + MemberId member_id_data = 0x00000005; + if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && + (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure data member TypeIdentifier inconsistent."); + return; + } + MemberName name_data = "data"; + eprosima::fastcdr::optional member_ann_builtin_data; + ann_custom_DdsTopic.reset(); + CompleteMemberDetail detail_data = TypeObjectUtils::build_complete_member_detail(name_data, member_ann_builtin_data, ann_custom_DdsTopic); + CompleteStructMember member_data = TypeObjectUtils::build_complete_struct_member(common_data, detail_data); + TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_data); + } + CompleteStructType struct_type_DdsTopic = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopic, header_DdsTopic, member_seq_DdsTopic); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopic, type_name_DdsTopic.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopic already registered in TypeObjectRegistry for a different type."); + } + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopic", type_ids_DdsTopic); + if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "DdsTopic: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_DdsTopic_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1()._d() || TK_NONE == type_ids_MonitoringTopics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_MonitoringTopics.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_MonitoringTopics.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_DdsTopic_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_MonitoringTopics.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_DdsTopic_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_DdsTopic_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_DdsTopic_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_DdsTopic_unbounded, element_flags_anonymous_sequence_DdsTopic_unbounded); + std::string type_id_kind_anonymous_sequence_DdsTopic_unbounded("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_DdsTopic_unbounded == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_DdsTopic_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopic_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopic_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopic_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_DdsTopic_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopic_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_DdsTopic_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopic_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_MonitoringTopics = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_DdsTopic_unbounded", type_ids_MonitoringTopics); + if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_DdsTopic_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_topics = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_topics; + MemberId member_id_topics = 0x00000000; + if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1()._d() || TK_NONE == type_ids_MonitoringTopics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, member_flags_topics, type_ids_MonitoringTopics.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, member_flags_topics, type_ids_MonitoringTopics.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure topics member TypeIdentifier inconsistent."); + return; + } + MemberName name_topics = "topics"; + eprosima::fastcdr::optional member_ann_builtin_topics; + ann_custom_MonitoringTopics.reset(); + CompleteMemberDetail detail_topics = TypeObjectUtils::build_complete_member_detail(name_topics, member_ann_builtin_topics, ann_custom_MonitoringTopics); + CompleteStructMember member_topics = TypeObjectUtils::build_complete_struct_member(common_topics, detail_topics); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringTopics, member_topics); + } + CompleteStructType struct_type_MonitoringTopics = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringTopics, header_MonitoringTopics, member_seq_MonitoringTopics); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringTopics, type_name_MonitoringTopics.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringTopics already registered in TypeObjectRegistry for a different type."); + } + return_code_MonitoringTopics = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringTopics", type_ids_MonitoringTopics); + if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MonitoringTopics: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopics.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopics.cxx deleted file mode 100644 index df3e5698..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopics.cxx +++ /dev/null @@ -1,969 +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 MonitoringTopics.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#include - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { -namespace internal { - -enum class Size -{ - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size( - int s) -{ - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH -{ - using type = std::uint8_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint16_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint32_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint64_t; -}; -} // namespace internal - -template -struct FindType -{ - using type = typename internal::FindTypeH::type; -}; -} // namespace helper - -#define DdsTopicData_max_cdr_typesize 280ULL; -#define MonitoringTopics_max_cdr_typesize 2853616ULL; -#define DdsTopic_max_cdr_typesize 28536ULL; - - - - -DdsTopicData::DdsTopicData() -{ - // /type_d() m_participant_id - - // unsigned long m_msgs_lost - m_msgs_lost = 0; - // unsigned long m_msgs_received - m_msgs_received = 0; - // double m_msg_rx_rate - m_msg_rx_rate = 0.0; - - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -DdsTopicData::~DdsTopicData() -{ -} - -DdsTopicData::DdsTopicData( - const DdsTopicData& x) -{ - m_participant_id = x.m_participant_id; - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - -} - -DdsTopicData::DdsTopicData( - DdsTopicData&& x) noexcept -{ - m_participant_id = std::move(x.m_participant_id); - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - -} - -DdsTopicData& DdsTopicData::operator =( - const DdsTopicData& x) -{ - m_participant_id = x.m_participant_id; - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - - return *this; -} - -DdsTopicData& DdsTopicData::operator =( - DdsTopicData&& x) noexcept -{ - m_participant_id = std::move(x.m_participant_id); - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - - return *this; -} - -bool DdsTopicData::operator ==( - const DdsTopicData& x) const -{ - return (m_participant_id == x.m_participant_id && - m_msgs_lost == x.m_msgs_lost && - m_msgs_received == x.m_msgs_received && - m_msg_rx_rate == x.m_msg_rx_rate); -} - -bool DdsTopicData::operator !=( - const DdsTopicData& x) const -{ - return !(*this == x); -} - -size_t DdsTopicData::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return DdsTopicData_max_cdr_typesize; -} - -size_t DdsTopicData::getCdrSerializedSize( - const DdsTopicData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.participant_id().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - return current_alignment - initial_alignment; -} - -void DdsTopicData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_participant_id.c_str(); - - scdr << m_msgs_lost; - - scdr << m_msgs_received; - - scdr << m_msg_rx_rate; - -} - -void DdsTopicData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_participant_id; - - - - dcdr >> m_msgs_lost; - - - - dcdr >> m_msgs_received; - - - - dcdr >> m_msg_rx_rate; - - -} - -bool DdsTopicData::isKeyDefined() -{ - return false; -} - -void DdsTopicData::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member participant_id - * @param _participant_id New value to be copied in member participant_id - */ -void DdsTopicData::participant_id( - const std::string& _participant_id) -{ - m_participant_id = _participant_id; -} - -/*! - * @brief This function moves the value in member participant_id - * @param _participant_id New value to be moved in member participant_id - */ -void DdsTopicData::participant_id( - std::string&& _participant_id) -{ - m_participant_id = std::move(_participant_id); -} - -/*! - * @brief This function returns a constant reference to member participant_id - * @return Constant reference to member participant_id - */ -const std::string& DdsTopicData::participant_id() const -{ - return m_participant_id; -} - -/*! - * @brief This function returns a reference to member participant_id - * @return Reference to member participant_id - */ -std::string& DdsTopicData::participant_id() -{ - return m_participant_id; -} - -/*! - * @brief This function sets a value in member msgs_lost - * @param _msgs_lost New value for member msgs_lost - */ -void DdsTopicData::msgs_lost( - uint32_t _msgs_lost) -{ - m_msgs_lost = _msgs_lost; -} - -/*! - * @brief This function returns the value of member msgs_lost - * @return Value of member msgs_lost - */ -uint32_t DdsTopicData::msgs_lost() const -{ - return m_msgs_lost; -} - -/*! - * @brief This function returns a reference to member msgs_lost - * @return Reference to member msgs_lost - */ -uint32_t& DdsTopicData::msgs_lost() -{ - return m_msgs_lost; -} - -/*! - * @brief This function sets a value in member msgs_received - * @param _msgs_received New value for member msgs_received - */ -void DdsTopicData::msgs_received( - uint32_t _msgs_received) -{ - m_msgs_received = _msgs_received; -} - -/*! - * @brief This function returns the value of member msgs_received - * @return Value of member msgs_received - */ -uint32_t DdsTopicData::msgs_received() const -{ - return m_msgs_received; -} - -/*! - * @brief This function returns a reference to member msgs_received - * @return Reference to member msgs_received - */ -uint32_t& DdsTopicData::msgs_received() -{ - return m_msgs_received; -} - -/*! - * @brief This function sets a value in member msg_rx_rate - * @param _msg_rx_rate New value for member msg_rx_rate - */ -void DdsTopicData::msg_rx_rate( - double _msg_rx_rate) -{ - m_msg_rx_rate = _msg_rx_rate; -} - -/*! - * @brief This function returns the value of member msg_rx_rate - * @return Value of member msg_rx_rate - */ -double DdsTopicData::msg_rx_rate() const -{ - return m_msg_rx_rate; -} - -/*! - * @brief This function returns a reference to member msg_rx_rate - * @return Reference to member msg_rx_rate - */ -double& DdsTopicData::msg_rx_rate() -{ - return m_msg_rx_rate; -} - -DdsTopic::DdsTopic() -{ - // /type_d() m_name - - // /type_d() m_type_name - - // boolean m_type_discovered - m_type_discovered = false; - // boolean m_type_mismatch - m_type_mismatch = false; - // boolean m_qos_mismatch - m_qos_mismatch = false; - // sequence m_data - - - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -DdsTopic::~DdsTopic() -{ -} - -DdsTopic::DdsTopic( - const DdsTopic& x) -{ - m_name = x.m_name; - - - m_type_name = x.m_type_name; - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = x.m_data; - -} - -DdsTopic::DdsTopic( - DdsTopic&& x) noexcept -{ - m_name = std::move(x.m_name); - - - m_type_name = std::move(x.m_type_name); - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = std::move(x.m_data); - -} - -DdsTopic& DdsTopic::operator =( - const DdsTopic& x) -{ - m_name = x.m_name; - - - m_type_name = x.m_type_name; - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = x.m_data; - - return *this; -} - -DdsTopic& DdsTopic::operator =( - DdsTopic&& x) noexcept -{ - m_name = std::move(x.m_name); - - - m_type_name = std::move(x.m_type_name); - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = std::move(x.m_data); - - return *this; -} - -bool DdsTopic::operator ==( - const DdsTopic& x) const -{ - return (m_name == x.m_name && - m_type_name == x.m_type_name && - m_type_discovered == x.m_type_discovered && - m_type_mismatch == x.m_type_mismatch && - m_qos_mismatch == x.m_qos_mismatch && - m_data == x.m_data); -} - -bool DdsTopic::operator !=( - const DdsTopic& x) const -{ - return !(*this == x); -} - -size_t DdsTopic::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return DdsTopic_max_cdr_typesize; -} - -size_t DdsTopic::getCdrSerializedSize( - const DdsTopic& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.name().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.type_name().size() + 1; - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for (size_t a = 0; a < data.data().size(); ++a) - { - current_alignment += DdsTopicData::getCdrSerializedSize(data.data().at(a), current_alignment); - } - - - - return current_alignment - initial_alignment; -} - -void DdsTopic::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_name.c_str(); - - scdr << m_type_name.c_str(); - - scdr << m_type_discovered; - - scdr << m_type_mismatch; - - scdr << m_qos_mismatch; - - scdr << m_data; - - -} - -void DdsTopic::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_name; - - - - dcdr >> m_type_name; - - - - dcdr >> m_type_discovered; - - - - dcdr >> m_type_mismatch; - - - - dcdr >> m_qos_mismatch; - - - - dcdr >> m_data; - - -} - -bool DdsTopic::isKeyDefined() -{ - return false; -} - -void DdsTopic::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member name - * @param _name New value to be copied in member name - */ -void DdsTopic::name( - const std::string& _name) -{ - m_name = _name; -} - -/*! - * @brief This function moves the value in member name - * @param _name New value to be moved in member name - */ -void DdsTopic::name( - std::string&& _name) -{ - m_name = std::move(_name); -} - -/*! - * @brief This function returns a constant reference to member name - * @return Constant reference to member name - */ -const std::string& DdsTopic::name() const -{ - return m_name; -} - -/*! - * @brief This function returns a reference to member name - * @return Reference to member name - */ -std::string& DdsTopic::name() -{ - return m_name; -} - -/*! - * @brief This function copies the value in member type_name - * @param _type_name New value to be copied in member type_name - */ -void DdsTopic::type_name( - const std::string& _type_name) -{ - m_type_name = _type_name; -} - -/*! - * @brief This function moves the value in member type_name - * @param _type_name New value to be moved in member type_name - */ -void DdsTopic::type_name( - std::string&& _type_name) -{ - m_type_name = std::move(_type_name); -} - -/*! - * @brief This function returns a constant reference to member type_name - * @return Constant reference to member type_name - */ -const std::string& DdsTopic::type_name() const -{ - return m_type_name; -} - -/*! - * @brief This function returns a reference to member type_name - * @return Reference to member type_name - */ -std::string& DdsTopic::type_name() -{ - return m_type_name; -} - -/*! - * @brief This function sets a value in member type_discovered - * @param _type_discovered New value for member type_discovered - */ -void DdsTopic::type_discovered( - bool _type_discovered) -{ - m_type_discovered = _type_discovered; -} - -/*! - * @brief This function returns the value of member type_discovered - * @return Value of member type_discovered - */ -bool DdsTopic::type_discovered() const -{ - return m_type_discovered; -} - -/*! - * @brief This function returns a reference to member type_discovered - * @return Reference to member type_discovered - */ -bool& DdsTopic::type_discovered() -{ - return m_type_discovered; -} - -/*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ -void DdsTopic::type_mismatch( - bool _type_mismatch) -{ - m_type_mismatch = _type_mismatch; -} - -/*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ -bool DdsTopic::type_mismatch() const -{ - return m_type_mismatch; -} - -/*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ -bool& DdsTopic::type_mismatch() -{ - return m_type_mismatch; -} - -/*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ -void DdsTopic::qos_mismatch( - bool _qos_mismatch) -{ - m_qos_mismatch = _qos_mismatch; -} - -/*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ -bool DdsTopic::qos_mismatch() const -{ - return m_qos_mismatch; -} - -/*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ -bool& DdsTopic::qos_mismatch() -{ - return m_qos_mismatch; -} - -/*! - * @brief This function copies the value in member data - * @param _data New value to be copied in member data - */ -void DdsTopic::data( - const std::vector& _data) -{ - m_data = _data; -} - -/*! - * @brief This function moves the value in member data - * @param _data New value to be moved in member data - */ -void DdsTopic::data( - std::vector&& _data) -{ - m_data = std::move(_data); -} - -/*! - * @brief This function returns a constant reference to member data - * @return Constant reference to member data - */ -const std::vector& DdsTopic::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -std::vector& DdsTopic::data() -{ - return m_data; -} - -MonitoringTopics::MonitoringTopics() -{ - // sequence m_topics - - - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -MonitoringTopics::~MonitoringTopics() -{ -} - -MonitoringTopics::MonitoringTopics( - const MonitoringTopics& x) -{ - m_topics = x.m_topics; - -} - -MonitoringTopics::MonitoringTopics( - MonitoringTopics&& x) noexcept -{ - m_topics = std::move(x.m_topics); - -} - -MonitoringTopics& MonitoringTopics::operator =( - const MonitoringTopics& x) -{ - m_topics = x.m_topics; - - return *this; -} - -MonitoringTopics& MonitoringTopics::operator =( - MonitoringTopics&& x) noexcept -{ - m_topics = std::move(x.m_topics); - - return *this; -} - -bool MonitoringTopics::operator ==( - const MonitoringTopics& x) const -{ - return (m_topics == x.m_topics); -} - -bool MonitoringTopics::operator !=( - const MonitoringTopics& x) const -{ - return !(*this == x); -} - -size_t MonitoringTopics::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return MonitoringTopics_max_cdr_typesize; -} - -size_t MonitoringTopics::getCdrSerializedSize( - const MonitoringTopics& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for (size_t a = 0; a < data.topics().size(); ++a) - { - current_alignment += DdsTopic::getCdrSerializedSize(data.topics().at(a), current_alignment); - } - - - - return current_alignment - initial_alignment; -} - -void MonitoringTopics::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_topics; - - -} - -void MonitoringTopics::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_topics; - - -} - -bool MonitoringTopics::isKeyDefined() -{ - return false; -} - -void MonitoringTopics::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member topics - * @param _topics New value to be copied in member topics - */ -void MonitoringTopics::topics( - const std::vector& _topics) -{ - m_topics = _topics; -} - -/*! - * @brief This function moves the value in member topics - * @param _topics New value to be moved in member topics - */ -void MonitoringTopics::topics( - std::vector&& _topics) -{ - m_topics = std::move(_topics); -} - -/*! - * @brief This function returns a constant reference to member topics - * @return Constant reference to member topics - */ -const std::vector& MonitoringTopics::topics() const -{ - return m_topics; -} - -/*! - * @brief This function returns a reference to member topics - * @return Reference to member topics - */ -std::vector& MonitoringTopics::topics() -{ - return m_topics; -} diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopicsTypeObject.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopicsTypeObject.cxx deleted file mode 100644 index 0323341f..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/topics/v1/MonitoringTopicsTypeObject.cxx +++ /dev/null @@ -1,878 +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 MonitoringTopicsTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // ifdef _WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerMonitoringTopicsTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory* factory = TypeObjectFactory::get_instance(); - factory->add_type_object("DdsTopicData", GetDdsTopicDataIdentifier(true), - GetDdsTopicDataObject(true)); - factory->add_type_object("DdsTopicData", GetDdsTopicDataIdentifier(false), - GetDdsTopicDataObject(false)); - - - factory->add_type_object("DdsTopic", GetDdsTopicIdentifier(true), - GetDdsTopicObject(true)); - factory->add_type_object("DdsTopic", GetDdsTopicIdentifier(false), - GetDdsTopicObject(false)); - - - factory->add_type_object("MonitoringTopics", GetMonitoringTopicsIdentifier(true), - GetMonitoringTopicsObject(true)); - factory->add_type_object("MonitoringTopics", GetMonitoringTopicsIdentifier(false), - GetMonitoringTopicsObject(false)); - - }); -} - -const TypeIdentifier* GetDdsTopicDataIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = - TypeObjectFactory::get_instance()->get_type_identifier("DdsTopicData", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetDdsTopicDataObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("DdsTopicData", complete); -} - -const TypeObject* GetDdsTopicDataObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteDdsTopicDataObject(); - } - //else - return GetMinimalDdsTopicDataObject(); -} - -const TypeObject* GetMinimalDdsTopicDataObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_participant_id; - mst_participant_id.common().member_id(memberId++); - mst_participant_id.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_participant_id.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_participant_id.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_participant_id.common().member_flags().IS_OPTIONAL(false); - mst_participant_id.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_participant_id.common().member_flags().IS_KEY(false); - mst_participant_id.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_participant_id.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 participant_id_hash("participant_id"); - for (int i = 0; i < 4; ++i) - { - mst_participant_id.detail().name_hash()[i] = participant_id_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_participant_id); - - MinimalStructMember mst_msgs_lost; - mst_msgs_lost.common().member_id(memberId++); - mst_msgs_lost.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_msgs_lost.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_msgs_lost.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_msgs_lost.common().member_flags().IS_OPTIONAL(false); - mst_msgs_lost.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_msgs_lost.common().member_flags().IS_KEY(false); - mst_msgs_lost.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_msgs_lost.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - MD5 msgs_lost_hash("msgs_lost"); - for (int i = 0; i < 4; ++i) - { - mst_msgs_lost.detail().name_hash()[i] = msgs_lost_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_msgs_lost); - - MinimalStructMember mst_msgs_received; - mst_msgs_received.common().member_id(memberId++); - mst_msgs_received.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_msgs_received.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_msgs_received.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_msgs_received.common().member_flags().IS_OPTIONAL(false); - mst_msgs_received.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_msgs_received.common().member_flags().IS_KEY(false); - mst_msgs_received.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_msgs_received.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", - false)); - - - MD5 msgs_received_hash("msgs_received"); - for (int i = 0; i < 4; ++i) - { - mst_msgs_received.detail().name_hash()[i] = msgs_received_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_msgs_received); - - MinimalStructMember mst_msg_rx_rate; - mst_msg_rx_rate.common().member_id(memberId++); - mst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_msg_rx_rate.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_msg_rx_rate.common().member_flags().IS_OPTIONAL(false); - mst_msg_rx_rate.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_msg_rx_rate.common().member_flags().IS_KEY(false); - mst_msg_rx_rate.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_msg_rx_rate.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", - false)); - - - MD5 msg_rx_rate_hash("msg_rx_rate"); - for (int i = 0; i < 4; ++i) - { - mst_msg_rx_rate.detail().name_hash()[i] = msg_rx_rate_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_msg_rx_rate); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopicData", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", false); -} - -const TypeObject* GetCompleteDdsTopicDataObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_participant_id; - cst_participant_id.common().member_id(memberId++); - cst_participant_id.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_participant_id.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_participant_id.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_participant_id.common().member_flags().IS_OPTIONAL(false); - cst_participant_id.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_participant_id.common().member_flags().IS_KEY(false); - cst_participant_id.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_participant_id.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_participant_id.detail().name("participant_id"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_participant_id); - - CompleteStructMember cst_msgs_lost; - cst_msgs_lost.common().member_id(memberId++); - cst_msgs_lost.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_msgs_lost.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_msgs_lost.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_msgs_lost.common().member_flags().IS_OPTIONAL(false); - cst_msgs_lost.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_msgs_lost.common().member_flags().IS_KEY(false); - cst_msgs_lost.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_msgs_lost.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - cst_msgs_lost.detail().name("msgs_lost"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_msgs_lost); - - CompleteStructMember cst_msgs_received; - cst_msgs_received.common().member_id(memberId++); - cst_msgs_received.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_msgs_received.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_msgs_received.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_msgs_received.common().member_flags().IS_OPTIONAL(false); - cst_msgs_received.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_msgs_received.common().member_flags().IS_KEY(false); - cst_msgs_received.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_msgs_received.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", - false)); - - - cst_msgs_received.detail().name("msgs_received"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_msgs_received); - - CompleteStructMember cst_msg_rx_rate; - cst_msg_rx_rate.common().member_id(memberId++); - cst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_msg_rx_rate.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_msg_rx_rate.common().member_flags().IS_OPTIONAL(false); - cst_msg_rx_rate.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_msg_rx_rate.common().member_flags().IS_KEY(false); - cst_msg_rx_rate.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_msg_rx_rate.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", - false)); - - - cst_msg_rx_rate.detail().name("msg_rx_rate"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_msg_rx_rate); - - - // Header - type_object->complete().struct_type().header().detail().type_name("DdsTopicData"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopicData", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", true); -} - -const TypeIdentifier* GetDdsTopicIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("DdsTopic", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetDdsTopicObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("DdsTopic", complete); -} - -const TypeObject* GetDdsTopicObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopic", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteDdsTopicObject(); - } - //else - return GetMinimalDdsTopicObject(); -} - -const TypeObject* GetMinimalDdsTopicObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopic", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_name; - mst_name.common().member_id(memberId++); - mst_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_name.common().member_flags().IS_OPTIONAL(false); - mst_name.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_name.common().member_flags().IS_KEY(false); - mst_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 name_hash("name"); - for (int i = 0; i < 4; ++i) - { - mst_name.detail().name_hash()[i] = name_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_name); - - MinimalStructMember mst_type_name; - mst_type_name.common().member_id(memberId++); - mst_type_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_name.common().member_flags().IS_OPTIONAL(false); - mst_type_name.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_name.common().member_flags().IS_KEY(false); - mst_type_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 type_name_hash("type_name"); - for (int i = 0; i < 4; ++i) - { - mst_type_name.detail().name_hash()[i] = type_name_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_name); - - MinimalStructMember mst_type_discovered; - mst_type_discovered.common().member_id(memberId++); - mst_type_discovered.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_discovered.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_discovered.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_discovered.common().member_flags().IS_OPTIONAL(false); - mst_type_discovered.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_discovered.common().member_flags().IS_KEY(false); - mst_type_discovered.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_discovered.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 type_discovered_hash("type_discovered"); - for (int i = 0; i < 4; ++i) - { - mst_type_discovered.detail().name_hash()[i] = type_discovered_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_discovered); - - MinimalStructMember mst_type_mismatch; - mst_type_mismatch.common().member_id(memberId++); - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_mismatch.common().member_flags().IS_KEY(false); - mst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 type_mismatch_hash("type_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_type_mismatch.detail().name_hash()[i] = type_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_mismatch); - - MinimalStructMember mst_qos_mismatch; - mst_qos_mismatch.common().member_id(memberId++); - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_qos_mismatch.common().member_flags().IS_KEY(false); - mst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 qos_mismatch_hash("qos_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_qos_mismatch.detail().name_hash()[i] = qos_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_qos_mismatch); - - MinimalStructMember mst_data; - mst_data.common().member_id(memberId++); - mst_data.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_data.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_data.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_data.common().member_flags().IS_OPTIONAL(false); - mst_data.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_data.common().member_flags().IS_KEY(false); - mst_data.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_data.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopicData", 100, - false)); - - MD5 data_hash("data"); - for (int i = 0; i < 4; ++i) - { - mst_data.detail().name_hash()[i] = data_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_data); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopic", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopic", false); -} - -const TypeObject* GetCompleteDdsTopicObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopic", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_name; - cst_name.common().member_id(memberId++); - cst_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_name.common().member_flags().IS_OPTIONAL(false); - cst_name.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_name.common().member_flags().IS_KEY(false); - cst_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_name.detail().name("name"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_name); - - CompleteStructMember cst_type_name; - cst_type_name.common().member_id(memberId++); - cst_type_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_name.common().member_flags().IS_OPTIONAL(false); - cst_type_name.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_name.common().member_flags().IS_KEY(false); - cst_type_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_type_name.detail().name("type_name"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_name); - - CompleteStructMember cst_type_discovered; - cst_type_discovered.common().member_id(memberId++); - cst_type_discovered.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_discovered.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_discovered.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_discovered.common().member_flags().IS_OPTIONAL(false); - cst_type_discovered.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_discovered.common().member_flags().IS_KEY(false); - cst_type_discovered.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_discovered.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_type_discovered.detail().name("type_discovered"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_discovered); - - CompleteStructMember cst_type_mismatch; - cst_type_mismatch.common().member_id(memberId++); - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_mismatch.common().member_flags().IS_KEY(false); - cst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_type_mismatch.detail().name("type_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_mismatch); - - CompleteStructMember cst_qos_mismatch; - cst_qos_mismatch.common().member_id(memberId++); - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_qos_mismatch.common().member_flags().IS_KEY(false); - cst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_qos_mismatch.detail().name("qos_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_qos_mismatch); - - CompleteStructMember cst_data; - cst_data.common().member_id(memberId++); - cst_data.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_data.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_data.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_data.common().member_flags().IS_OPTIONAL(false); - cst_data.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_data.common().member_flags().IS_KEY(false); - cst_data.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_data.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopicData", 100, - true)); - - cst_data.detail().name("data"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_data); - - - // Header - type_object->complete().struct_type().header().detail().type_name("DdsTopic"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopic", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopic", true); -} - -const TypeIdentifier* GetMonitoringTopicsIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MonitoringTopics", - complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMonitoringTopicsObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("MonitoringTopics", complete); -} - -const TypeObject* GetMonitoringTopicsObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMonitoringTopicsObject(); - } - //else - return GetMinimalMonitoringTopicsObject(); -} - -const TypeObject* GetMinimalMonitoringTopicsObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_topics; - mst_topics.common().member_id(memberId++); - mst_topics.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_topics.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_topics.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_topics.common().member_flags().IS_OPTIONAL(false); - mst_topics.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_topics.common().member_flags().IS_KEY(false); - mst_topics.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_topics.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopic", 100, - false)); - - MD5 topics_hash("topics"); - for (int i = 0; i < 4; ++i) - { - mst_topics.detail().name_hash()[i] = topics_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_topics); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringTopics", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", false); -} - -const TypeObject* GetCompleteMonitoringTopicsObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_topics; - cst_topics.common().member_id(memberId++); - cst_topics.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_topics.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_topics.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_topics.common().member_flags().IS_OPTIONAL(false); - cst_topics.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_topics.common().member_flags().IS_KEY(false); - cst_topics.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_topics.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopic", 100, - true)); - - cst_topics.detail().name("topics"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_topics); - - - // Header - type_object->complete().struct_type().header().detail().type_name("MonitoringTopics"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringTopics", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", true); -} diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopics.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopics.cxx deleted file mode 100644 index 1c6e67b3..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopics.cxx +++ /dev/null @@ -1,597 +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 MonitoringTopics.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#if FASTCDR_VERSION_MAJOR > 1 - -#include - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -DdsTopicData::DdsTopicData() -{ - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -DdsTopicData::~DdsTopicData() -{ -} - -DdsTopicData::DdsTopicData( - const DdsTopicData& x) -{ - m_participant_id = x.m_participant_id; - m_msgs_lost = x.m_msgs_lost; - m_msgs_received = x.m_msgs_received; - m_msg_rx_rate = x.m_msg_rx_rate; -} - -DdsTopicData::DdsTopicData( - DdsTopicData&& x) noexcept -{ - m_participant_id = std::move(x.m_participant_id); - m_msgs_lost = x.m_msgs_lost; - m_msgs_received = x.m_msgs_received; - m_msg_rx_rate = x.m_msg_rx_rate; -} - -DdsTopicData& DdsTopicData::operator =( - const DdsTopicData& x) -{ - - m_participant_id = x.m_participant_id; - m_msgs_lost = x.m_msgs_lost; - m_msgs_received = x.m_msgs_received; - m_msg_rx_rate = x.m_msg_rx_rate; - return *this; -} - -DdsTopicData& DdsTopicData::operator =( - DdsTopicData&& x) noexcept -{ - - m_participant_id = std::move(x.m_participant_id); - m_msgs_lost = x.m_msgs_lost; - m_msgs_received = x.m_msgs_received; - m_msg_rx_rate = x.m_msg_rx_rate; - return *this; -} - -bool DdsTopicData::operator ==( - const DdsTopicData& x) const -{ - return (m_participant_id == x.m_participant_id && - m_msgs_lost == x.m_msgs_lost && - m_msgs_received == x.m_msgs_received && - m_msg_rx_rate == x.m_msg_rx_rate); -} - -bool DdsTopicData::operator !=( - const DdsTopicData& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member participant_id - * @param _participant_id New value to be copied in member participant_id - */ -void DdsTopicData::participant_id( - const std::string& _participant_id) -{ - m_participant_id = _participant_id; -} - -/*! - * @brief This function moves the value in member participant_id - * @param _participant_id New value to be moved in member participant_id - */ -void DdsTopicData::participant_id( - std::string&& _participant_id) -{ - m_participant_id = std::move(_participant_id); -} - -/*! - * @brief This function returns a constant reference to member participant_id - * @return Constant reference to member participant_id - */ -const std::string& DdsTopicData::participant_id() const -{ - return m_participant_id; -} - -/*! - * @brief This function returns a reference to member participant_id - * @return Reference to member participant_id - */ -std::string& DdsTopicData::participant_id() -{ - return m_participant_id; -} - -/*! - * @brief This function sets a value in member msgs_lost - * @param _msgs_lost New value for member msgs_lost - */ -void DdsTopicData::msgs_lost( - uint32_t _msgs_lost) -{ - m_msgs_lost = _msgs_lost; -} - -/*! - * @brief This function returns the value of member msgs_lost - * @return Value of member msgs_lost - */ -uint32_t DdsTopicData::msgs_lost() const -{ - return m_msgs_lost; -} - -/*! - * @brief This function returns a reference to member msgs_lost - * @return Reference to member msgs_lost - */ -uint32_t& DdsTopicData::msgs_lost() -{ - return m_msgs_lost; -} - -/*! - * @brief This function sets a value in member msgs_received - * @param _msgs_received New value for member msgs_received - */ -void DdsTopicData::msgs_received( - uint32_t _msgs_received) -{ - m_msgs_received = _msgs_received; -} - -/*! - * @brief This function returns the value of member msgs_received - * @return Value of member msgs_received - */ -uint32_t DdsTopicData::msgs_received() const -{ - return m_msgs_received; -} - -/*! - * @brief This function returns a reference to member msgs_received - * @return Reference to member msgs_received - */ -uint32_t& DdsTopicData::msgs_received() -{ - return m_msgs_received; -} - -/*! - * @brief This function sets a value in member msg_rx_rate - * @param _msg_rx_rate New value for member msg_rx_rate - */ -void DdsTopicData::msg_rx_rate( - double _msg_rx_rate) -{ - m_msg_rx_rate = _msg_rx_rate; -} - -/*! - * @brief This function returns the value of member msg_rx_rate - * @return Value of member msg_rx_rate - */ -double DdsTopicData::msg_rx_rate() const -{ - return m_msg_rx_rate; -} - -/*! - * @brief This function returns a reference to member msg_rx_rate - * @return Reference to member msg_rx_rate - */ -double& DdsTopicData::msg_rx_rate() -{ - return m_msg_rx_rate; -} - -DdsTopic::DdsTopic() -{ - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -DdsTopic::~DdsTopic() -{ -} - -DdsTopic::DdsTopic( - const DdsTopic& x) -{ - m_name = x.m_name; - m_type_name = x.m_type_name; - m_type_discovered = x.m_type_discovered; - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; - m_data = x.m_data; -} - -DdsTopic::DdsTopic( - DdsTopic&& x) noexcept -{ - m_name = std::move(x.m_name); - m_type_name = std::move(x.m_type_name); - m_type_discovered = x.m_type_discovered; - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; - m_data = std::move(x.m_data); -} - -DdsTopic& DdsTopic::operator =( - const DdsTopic& x) -{ - - m_name = x.m_name; - m_type_name = x.m_type_name; - m_type_discovered = x.m_type_discovered; - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; - m_data = x.m_data; - return *this; -} - -DdsTopic& DdsTopic::operator =( - DdsTopic&& x) noexcept -{ - - m_name = std::move(x.m_name); - m_type_name = std::move(x.m_type_name); - m_type_discovered = x.m_type_discovered; - m_type_mismatch = x.m_type_mismatch; - m_qos_mismatch = x.m_qos_mismatch; - m_data = std::move(x.m_data); - return *this; -} - -bool DdsTopic::operator ==( - const DdsTopic& x) const -{ - return (m_name == x.m_name && - m_type_name == x.m_type_name && - m_type_discovered == x.m_type_discovered && - m_type_mismatch == x.m_type_mismatch && - m_qos_mismatch == x.m_qos_mismatch && - m_data == x.m_data); -} - -bool DdsTopic::operator !=( - const DdsTopic& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member name - * @param _name New value to be copied in member name - */ -void DdsTopic::name( - const std::string& _name) -{ - m_name = _name; -} - -/*! - * @brief This function moves the value in member name - * @param _name New value to be moved in member name - */ -void DdsTopic::name( - std::string&& _name) -{ - m_name = std::move(_name); -} - -/*! - * @brief This function returns a constant reference to member name - * @return Constant reference to member name - */ -const std::string& DdsTopic::name() const -{ - return m_name; -} - -/*! - * @brief This function returns a reference to member name - * @return Reference to member name - */ -std::string& DdsTopic::name() -{ - return m_name; -} - -/*! - * @brief This function copies the value in member type_name - * @param _type_name New value to be copied in member type_name - */ -void DdsTopic::type_name( - const std::string& _type_name) -{ - m_type_name = _type_name; -} - -/*! - * @brief This function moves the value in member type_name - * @param _type_name New value to be moved in member type_name - */ -void DdsTopic::type_name( - std::string&& _type_name) -{ - m_type_name = std::move(_type_name); -} - -/*! - * @brief This function returns a constant reference to member type_name - * @return Constant reference to member type_name - */ -const std::string& DdsTopic::type_name() const -{ - return m_type_name; -} - -/*! - * @brief This function returns a reference to member type_name - * @return Reference to member type_name - */ -std::string& DdsTopic::type_name() -{ - return m_type_name; -} - -/*! - * @brief This function sets a value in member type_discovered - * @param _type_discovered New value for member type_discovered - */ -void DdsTopic::type_discovered( - bool _type_discovered) -{ - m_type_discovered = _type_discovered; -} - -/*! - * @brief This function returns the value of member type_discovered - * @return Value of member type_discovered - */ -bool DdsTopic::type_discovered() const -{ - return m_type_discovered; -} - -/*! - * @brief This function returns a reference to member type_discovered - * @return Reference to member type_discovered - */ -bool& DdsTopic::type_discovered() -{ - return m_type_discovered; -} - -/*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ -void DdsTopic::type_mismatch( - bool _type_mismatch) -{ - m_type_mismatch = _type_mismatch; -} - -/*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ -bool DdsTopic::type_mismatch() const -{ - return m_type_mismatch; -} - -/*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ -bool& DdsTopic::type_mismatch() -{ - return m_type_mismatch; -} - -/*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ -void DdsTopic::qos_mismatch( - bool _qos_mismatch) -{ - m_qos_mismatch = _qos_mismatch; -} - -/*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ -bool DdsTopic::qos_mismatch() const -{ - return m_qos_mismatch; -} - -/*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ -bool& DdsTopic::qos_mismatch() -{ - return m_qos_mismatch; -} - -/*! - * @brief This function copies the value in member data - * @param _data New value to be copied in member data - */ -void DdsTopic::data( - const std::vector& _data) -{ - m_data = _data; -} - -/*! - * @brief This function moves the value in member data - * @param _data New value to be moved in member data - */ -void DdsTopic::data( - std::vector&& _data) -{ - m_data = std::move(_data); -} - -/*! - * @brief This function returns a constant reference to member data - * @return Constant reference to member data - */ -const std::vector& DdsTopic::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -std::vector& DdsTopic::data() -{ - return m_data; -} - -MonitoringTopics::MonitoringTopics() -{ - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -MonitoringTopics::~MonitoringTopics() -{ -} - -MonitoringTopics::MonitoringTopics( - const MonitoringTopics& x) -{ - m_topics = x.m_topics; -} - -MonitoringTopics::MonitoringTopics( - MonitoringTopics&& x) noexcept -{ - m_topics = std::move(x.m_topics); -} - -MonitoringTopics& MonitoringTopics::operator =( - const MonitoringTopics& x) -{ - - m_topics = x.m_topics; - return *this; -} - -MonitoringTopics& MonitoringTopics::operator =( - MonitoringTopics&& x) noexcept -{ - - m_topics = std::move(x.m_topics); - return *this; -} - -bool MonitoringTopics::operator ==( - const MonitoringTopics& x) const -{ - return (m_topics == x.m_topics); -} - -bool MonitoringTopics::operator !=( - const MonitoringTopics& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member topics - * @param _topics New value to be copied in member topics - */ -void MonitoringTopics::topics( - const std::vector& _topics) -{ - m_topics = _topics; -} - -/*! - * @brief This function moves the value in member topics - * @param _topics New value to be moved in member topics - */ -void MonitoringTopics::topics( - std::vector&& _topics) -{ - m_topics = std::move(_topics); -} - -/*! - * @brief This function returns a constant reference to member topics - * @return Constant reference to member topics - */ -const std::vector& MonitoringTopics::topics() const -{ - return m_topics; -} - -/*! - * @brief This function returns a reference to member topics - * @return Reference to member topics - */ -std::vector& MonitoringTopics::topics() -{ - return m_topics; -} - -// Include auxiliary functions like for serializing/deserializing. -#include - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.cxx deleted file mode 100644 index fbbf0abd..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsPubSubTypes.cxx +++ /dev/null @@ -1,599 +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 MonitoringTopicsPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#include - -#include -#include - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; -using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - -DdsTopicDataPubSubType::DdsTopicDataPubSubType() -{ - setName("DdsTopicData"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(DdsTopicData::getMaxCdrSerializedSize()); -#else - DdsTopicData_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = DdsTopicData_max_key_cdr_typesize > 16 ? DdsTopicData_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -DdsTopicDataPubSubType::~DdsTopicDataPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool DdsTopicDataPubSubType::serialize( - void* data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - DdsTopicData* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool DdsTopicDataPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - DdsTopicData* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function DdsTopicDataPubSubType::getSerializedSizeProvider( - void* data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* DdsTopicDataPubSubType::createData() -{ - return reinterpret_cast(new DdsTopicData()); -} - -void DdsTopicDataPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool DdsTopicDataPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - DdsTopicData* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - DdsTopicData_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || DdsTopicData_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -DdsTopicPubSubType::DdsTopicPubSubType() -{ - setName("DdsTopic"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(DdsTopic::getMaxCdrSerializedSize()); -#else - DdsTopic_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = DdsTopic_max_key_cdr_typesize > 16 ? DdsTopic_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -DdsTopicPubSubType::~DdsTopicPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool DdsTopicPubSubType::serialize( - void* data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - DdsTopic* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool DdsTopicPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - DdsTopic* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function DdsTopicPubSubType::getSerializedSizeProvider( - void* data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* DdsTopicPubSubType::createData() -{ - return reinterpret_cast(new DdsTopic()); -} - -void DdsTopicPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool DdsTopicPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - DdsTopic* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - DdsTopic_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || DdsTopic_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -MonitoringTopicsPubSubType::MonitoringTopicsPubSubType() -{ - setName("MonitoringTopics"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringTopics::getMaxCdrSerializedSize()); -#else - MonitoringTopics_max_cdr_typesize; -#endif // if FASTCDR_VERSION_MAJOR == 1 - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = MonitoringTopics_max_key_cdr_typesize > 16 ? MonitoringTopics_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -MonitoringTopicsPubSubType::~MonitoringTopicsPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool MonitoringTopicsPubSubType::serialize( - void* data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - MonitoringTopics* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool MonitoringTopicsPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - MonitoringTopics* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function MonitoringTopicsPubSubType::getSerializedSizeProvider( - void* data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* MonitoringTopicsPubSubType::createData() -{ - return reinterpret_cast(new MonitoringTopics()); -} - -void MonitoringTopicsPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool MonitoringTopicsPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - MonitoringTopics* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - MonitoringTopics_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || MonitoringTopics_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsTypeObject.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsTypeObject.cxx deleted file mode 100644 index 1fadc2cc..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsTypeObject.cxx +++ /dev/null @@ -1,878 +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 MonitoringTopicsTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // ifdef _WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerMonitoringTopicsTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory* factory = TypeObjectFactory::get_instance(); - factory->add_type_object("DdsTopicData", GetDdsTopicDataIdentifier(true), - GetDdsTopicDataObject(true)); - factory->add_type_object("DdsTopicData", GetDdsTopicDataIdentifier(false), - GetDdsTopicDataObject(false)); - - - factory->add_type_object("DdsTopic", GetDdsTopicIdentifier(true), - GetDdsTopicObject(true)); - factory->add_type_object("DdsTopic", GetDdsTopicIdentifier(false), - GetDdsTopicObject(false)); - - - factory->add_type_object("MonitoringTopics", GetMonitoringTopicsIdentifier(true), - GetMonitoringTopicsObject(true)); - factory->add_type_object("MonitoringTopics", GetMonitoringTopicsIdentifier(false), - GetMonitoringTopicsObject(false)); - - }); -} - -const TypeIdentifier* GetDdsTopicDataIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = - TypeObjectFactory::get_instance()->get_type_identifier("DdsTopicData", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetDdsTopicDataObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("DdsTopicData", complete); -} - -const TypeObject* GetDdsTopicDataObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteDdsTopicDataObject(); - } - //else - return GetMinimalDdsTopicDataObject(); -} - -const TypeObject* GetMinimalDdsTopicDataObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_participant_id; - mst_participant_id.common().member_id(memberId++); - mst_participant_id.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_participant_id.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_participant_id.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_participant_id.common().member_flags().IS_OPTIONAL(false); - mst_participant_id.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_participant_id.common().member_flags().IS_KEY(false); - mst_participant_id.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_participant_id.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 participant_id_hash("participant_id"); - for (int i = 0; i < 4; ++i) - { - mst_participant_id.detail().name_hash()[i] = participant_id_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_participant_id); - - MinimalStructMember mst_msgs_lost; - mst_msgs_lost.common().member_id(memberId++); - mst_msgs_lost.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_msgs_lost.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_msgs_lost.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_msgs_lost.common().member_flags().IS_OPTIONAL(false); - mst_msgs_lost.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_msgs_lost.common().member_flags().IS_KEY(false); - mst_msgs_lost.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_msgs_lost.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - MD5 msgs_lost_hash("msgs_lost"); - for (int i = 0; i < 4; ++i) - { - mst_msgs_lost.detail().name_hash()[i] = msgs_lost_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_msgs_lost); - - MinimalStructMember mst_msgs_received; - mst_msgs_received.common().member_id(memberId++); - mst_msgs_received.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_msgs_received.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_msgs_received.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_msgs_received.common().member_flags().IS_OPTIONAL(false); - mst_msgs_received.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_msgs_received.common().member_flags().IS_KEY(false); - mst_msgs_received.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_msgs_received.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", - false)); - - - MD5 msgs_received_hash("msgs_received"); - for (int i = 0; i < 4; ++i) - { - mst_msgs_received.detail().name_hash()[i] = msgs_received_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_msgs_received); - - MinimalStructMember mst_msg_rx_rate; - mst_msg_rx_rate.common().member_id(memberId++); - mst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_msg_rx_rate.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_msg_rx_rate.common().member_flags().IS_OPTIONAL(false); - mst_msg_rx_rate.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_msg_rx_rate.common().member_flags().IS_KEY(false); - mst_msg_rx_rate.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_msg_rx_rate.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", - false)); - - - MD5 msg_rx_rate_hash("msg_rx_rate"); - for (int i = 0; i < 4; ++i) - { - mst_msg_rx_rate.detail().name_hash()[i] = msg_rx_rate_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_msg_rx_rate); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopicData", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", false); -} - -const TypeObject* GetCompleteDdsTopicDataObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_participant_id; - cst_participant_id.common().member_id(memberId++); - cst_participant_id.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_participant_id.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_participant_id.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_participant_id.common().member_flags().IS_OPTIONAL(false); - cst_participant_id.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_participant_id.common().member_flags().IS_KEY(false); - cst_participant_id.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_participant_id.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_participant_id.detail().name("participant_id"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_participant_id); - - CompleteStructMember cst_msgs_lost; - cst_msgs_lost.common().member_id(memberId++); - cst_msgs_lost.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_msgs_lost.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_msgs_lost.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_msgs_lost.common().member_flags().IS_OPTIONAL(false); - cst_msgs_lost.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_msgs_lost.common().member_flags().IS_KEY(false); - cst_msgs_lost.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_msgs_lost.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - cst_msgs_lost.detail().name("msgs_lost"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_msgs_lost); - - CompleteStructMember cst_msgs_received; - cst_msgs_received.common().member_id(memberId++); - cst_msgs_received.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_msgs_received.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_msgs_received.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_msgs_received.common().member_flags().IS_OPTIONAL(false); - cst_msgs_received.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_msgs_received.common().member_flags().IS_KEY(false); - cst_msgs_received.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_msgs_received.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", - false)); - - - cst_msgs_received.detail().name("msgs_received"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_msgs_received); - - CompleteStructMember cst_msg_rx_rate; - cst_msg_rx_rate.common().member_id(memberId++); - cst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_msg_rx_rate.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_msg_rx_rate.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_msg_rx_rate.common().member_flags().IS_OPTIONAL(false); - cst_msg_rx_rate.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_msg_rx_rate.common().member_flags().IS_KEY(false); - cst_msg_rx_rate.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_msg_rx_rate.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", - false)); - - - cst_msg_rx_rate.detail().name("msg_rx_rate"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_msg_rx_rate); - - - // Header - type_object->complete().struct_type().header().detail().type_name("DdsTopicData"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopicData", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopicData", true); -} - -const TypeIdentifier* GetDdsTopicIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("DdsTopic", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetDdsTopicObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("DdsTopic", complete); -} - -const TypeObject* GetDdsTopicObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopic", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteDdsTopicObject(); - } - //else - return GetMinimalDdsTopicObject(); -} - -const TypeObject* GetMinimalDdsTopicObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopic", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_name; - mst_name.common().member_id(memberId++); - mst_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_name.common().member_flags().IS_OPTIONAL(false); - mst_name.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_name.common().member_flags().IS_KEY(false); - mst_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 name_hash("name"); - for (int i = 0; i < 4; ++i) - { - mst_name.detail().name_hash()[i] = name_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_name); - - MinimalStructMember mst_type_name; - mst_type_name.common().member_id(memberId++); - mst_type_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_name.common().member_flags().IS_OPTIONAL(false); - mst_type_name.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_name.common().member_flags().IS_KEY(false); - mst_type_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 type_name_hash("type_name"); - for (int i = 0; i < 4; ++i) - { - mst_type_name.detail().name_hash()[i] = type_name_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_name); - - MinimalStructMember mst_type_discovered; - mst_type_discovered.common().member_id(memberId++); - mst_type_discovered.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_discovered.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_discovered.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_discovered.common().member_flags().IS_OPTIONAL(false); - mst_type_discovered.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_discovered.common().member_flags().IS_KEY(false); - mst_type_discovered.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_discovered.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 type_discovered_hash("type_discovered"); - for (int i = 0; i < 4; ++i) - { - mst_type_discovered.detail().name_hash()[i] = type_discovered_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_discovered); - - MinimalStructMember mst_type_mismatch; - mst_type_mismatch.common().member_id(memberId++); - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_type_mismatch.common().member_flags().IS_KEY(false); - mst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 type_mismatch_hash("type_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_type_mismatch.detail().name_hash()[i] = type_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_type_mismatch); - - MinimalStructMember mst_qos_mismatch; - mst_qos_mismatch.common().member_id(memberId++); - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - mst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_qos_mismatch.common().member_flags().IS_KEY(false); - mst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 qos_mismatch_hash("qos_mismatch"); - for (int i = 0; i < 4; ++i) - { - mst_qos_mismatch.detail().name_hash()[i] = qos_mismatch_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_qos_mismatch); - - MinimalStructMember mst_data; - mst_data.common().member_id(memberId++); - mst_data.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_data.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_data.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_data.common().member_flags().IS_OPTIONAL(false); - mst_data.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_data.common().member_flags().IS_KEY(false); - mst_data.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_data.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopicData", 100, - false)); - - MD5 data_hash("data"); - for (int i = 0; i < 4; ++i) - { - mst_data.detail().name_hash()[i] = data_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_data); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopic", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopic", false); -} - -const TypeObject* GetCompleteDdsTopicObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("DdsTopic", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_name; - cst_name.common().member_id(memberId++); - cst_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_name.common().member_flags().IS_OPTIONAL(false); - cst_name.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_name.common().member_flags().IS_KEY(false); - cst_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_name.detail().name("name"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_name); - - CompleteStructMember cst_type_name; - cst_type_name.common().member_id(memberId++); - cst_type_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_name.common().member_flags().IS_OPTIONAL(false); - cst_type_name.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_name.common().member_flags().IS_KEY(false); - cst_type_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_type_name.detail().name("type_name"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_name); - - CompleteStructMember cst_type_discovered; - cst_type_discovered.common().member_id(memberId++); - cst_type_discovered.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_discovered.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_discovered.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_discovered.common().member_flags().IS_OPTIONAL(false); - cst_type_discovered.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_discovered.common().member_flags().IS_KEY(false); - cst_type_discovered.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_discovered.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_type_discovered.detail().name("type_discovered"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_discovered); - - CompleteStructMember cst_type_mismatch; - cst_type_mismatch.common().member_id(memberId++); - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_type_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_type_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_type_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_type_mismatch.common().member_flags().IS_KEY(false); - cst_type_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_type_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_type_mismatch.detail().name("type_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_type_mismatch); - - CompleteStructMember cst_qos_mismatch; - cst_qos_mismatch.common().member_id(memberId++); - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_qos_mismatch.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_qos_mismatch.common().member_flags().IS_OPTIONAL(false); - cst_qos_mismatch.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_qos_mismatch.common().member_flags().IS_KEY(false); - cst_qos_mismatch.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_qos_mismatch.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_qos_mismatch.detail().name("qos_mismatch"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_qos_mismatch); - - CompleteStructMember cst_data; - cst_data.common().member_id(memberId++); - cst_data.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_data.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_data.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_data.common().member_flags().IS_OPTIONAL(false); - cst_data.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_data.common().member_flags().IS_KEY(false); - cst_data.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_data.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopicData", 100, - true)); - - cst_data.detail().name("data"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_data); - - - // Header - type_object->complete().struct_type().header().detail().type_name("DdsTopic"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("DdsTopic", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("DdsTopic", true); -} - -const TypeIdentifier* GetMonitoringTopicsIdentifier( - bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MonitoringTopics", - complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMonitoringTopicsObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("MonitoringTopics", complete); -} - -const TypeObject* GetMonitoringTopicsObject( - bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMonitoringTopicsObject(); - } - //else - return GetMinimalMonitoringTopicsObject(); -} - -const TypeObject* GetMinimalMonitoringTopicsObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_topics; - mst_topics.common().member_id(memberId++); - mst_topics.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_topics.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_topics.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_topics.common().member_flags().IS_OPTIONAL(false); - mst_topics.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_topics.common().member_flags().IS_KEY(false); - mst_topics.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_topics.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopic", 100, - false)); - - MD5 topics_hash("topics"); - for (int i = 0; i < 4; ++i) - { - mst_topics.detail().name_hash()[i] = topics_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_topics); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringTopics", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", false); -} - -const TypeObject* GetCompleteMonitoringTopicsObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject* type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_topics; - cst_topics.common().member_id(memberId++); - cst_topics.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_topics.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_topics.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_topics.common().member_flags().IS_OPTIONAL(false); - cst_topics.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_topics.common().member_flags().IS_KEY(false); - cst_topics.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_topics.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("DdsTopic", 100, - true)); - - cst_topics.detail().name("topics"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_topics); - - - // Header - type_object->complete().struct_type().header().detail().type_name("MonitoringTopics"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for (int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MonitoringTopics", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("MonitoringTopics", true); -} diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsv1.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsv1.cxx deleted file mode 100644 index 8d36413a..00000000 --- a/ddspipe_core/src/cpp/types/monitoring/topics/v2/MonitoringTopicsv1.cxx +++ /dev/null @@ -1,973 +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 MonitoringTopics.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#include - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { -namespace internal { - -enum class Size -{ - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size( - int s) -{ - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH -{ - using type = std::uint8_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint16_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint32_t; -}; - -template<> -struct FindTypeH -{ - using type = std::uint64_t; -}; -} // namespace internal - -template -struct FindType -{ - using type = typename internal::FindTypeH::type; -}; -} // namespace helper - -#define DdsTopicData_max_cdr_typesize 280ULL; -#define MonitoringTopics_max_cdr_typesize 2853616ULL; -#define DdsTopic_max_cdr_typesize 28536ULL; - - - - -DdsTopicData::DdsTopicData() -{ - // /type_d() m_participant_id - - // unsigned long m_msgs_lost - m_msgs_lost = 0; - // unsigned long m_msgs_received - m_msgs_received = 0; - // double m_msg_rx_rate - m_msg_rx_rate = 0.0; - - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -DdsTopicData::~DdsTopicData() -{ -} - -DdsTopicData::DdsTopicData( - const DdsTopicData& x) -{ - m_participant_id = x.m_participant_id; - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - -} - -DdsTopicData::DdsTopicData( - DdsTopicData&& x) noexcept -{ - m_participant_id = std::move(x.m_participant_id); - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - -} - -DdsTopicData& DdsTopicData::operator =( - const DdsTopicData& x) -{ - m_participant_id = x.m_participant_id; - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - - return *this; -} - -DdsTopicData& DdsTopicData::operator =( - DdsTopicData&& x) noexcept -{ - m_participant_id = std::move(x.m_participant_id); - - - m_msgs_lost = x.m_msgs_lost; - - - m_msgs_received = x.m_msgs_received; - - - m_msg_rx_rate = x.m_msg_rx_rate; - - return *this; -} - -bool DdsTopicData::operator ==( - const DdsTopicData& x) const -{ - return (m_participant_id == x.m_participant_id && - m_msgs_lost == x.m_msgs_lost && - m_msgs_received == x.m_msgs_received && - m_msg_rx_rate == x.m_msg_rx_rate); -} - -bool DdsTopicData::operator !=( - const DdsTopicData& x) const -{ - return !(*this == x); -} - -size_t DdsTopicData::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return DdsTopicData_max_cdr_typesize; -} - -size_t DdsTopicData::getCdrSerializedSize( - const DdsTopicData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.participant_id().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - return current_alignment - initial_alignment; -} - -void DdsTopicData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_participant_id.c_str(); - - scdr << m_msgs_lost; - - scdr << m_msgs_received; - - scdr << m_msg_rx_rate; - -} - -void DdsTopicData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_participant_id; - - - - dcdr >> m_msgs_lost; - - - - dcdr >> m_msgs_received; - - - - dcdr >> m_msg_rx_rate; - - -} - -bool DdsTopicData::isKeyDefined() -{ - return false; -} - -void DdsTopicData::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member participant_id - * @param _participant_id New value to be copied in member participant_id - */ -void DdsTopicData::participant_id( - const std::string& _participant_id) -{ - m_participant_id = _participant_id; -} - -/*! - * @brief This function moves the value in member participant_id - * @param _participant_id New value to be moved in member participant_id - */ -void DdsTopicData::participant_id( - std::string&& _participant_id) -{ - m_participant_id = std::move(_participant_id); -} - -/*! - * @brief This function returns a constant reference to member participant_id - * @return Constant reference to member participant_id - */ -const std::string& DdsTopicData::participant_id() const -{ - return m_participant_id; -} - -/*! - * @brief This function returns a reference to member participant_id - * @return Reference to member participant_id - */ -std::string& DdsTopicData::participant_id() -{ - return m_participant_id; -} - -/*! - * @brief This function sets a value in member msgs_lost - * @param _msgs_lost New value for member msgs_lost - */ -void DdsTopicData::msgs_lost( - uint32_t _msgs_lost) -{ - m_msgs_lost = _msgs_lost; -} - -/*! - * @brief This function returns the value of member msgs_lost - * @return Value of member msgs_lost - */ -uint32_t DdsTopicData::msgs_lost() const -{ - return m_msgs_lost; -} - -/*! - * @brief This function returns a reference to member msgs_lost - * @return Reference to member msgs_lost - */ -uint32_t& DdsTopicData::msgs_lost() -{ - return m_msgs_lost; -} - -/*! - * @brief This function sets a value in member msgs_received - * @param _msgs_received New value for member msgs_received - */ -void DdsTopicData::msgs_received( - uint32_t _msgs_received) -{ - m_msgs_received = _msgs_received; -} - -/*! - * @brief This function returns the value of member msgs_received - * @return Value of member msgs_received - */ -uint32_t DdsTopicData::msgs_received() const -{ - return m_msgs_received; -} - -/*! - * @brief This function returns a reference to member msgs_received - * @return Reference to member msgs_received - */ -uint32_t& DdsTopicData::msgs_received() -{ - return m_msgs_received; -} - -/*! - * @brief This function sets a value in member msg_rx_rate - * @param _msg_rx_rate New value for member msg_rx_rate - */ -void DdsTopicData::msg_rx_rate( - double _msg_rx_rate) -{ - m_msg_rx_rate = _msg_rx_rate; -} - -/*! - * @brief This function returns the value of member msg_rx_rate - * @return Value of member msg_rx_rate - */ -double DdsTopicData::msg_rx_rate() const -{ - return m_msg_rx_rate; -} - -/*! - * @brief This function returns a reference to member msg_rx_rate - * @return Reference to member msg_rx_rate - */ -double& DdsTopicData::msg_rx_rate() -{ - return m_msg_rx_rate; -} - -DdsTopic::DdsTopic() -{ - // /type_d() m_name - - // /type_d() m_type_name - - // boolean m_type_discovered - m_type_discovered = false; - // boolean m_type_mismatch - m_type_mismatch = false; - // boolean m_qos_mismatch - m_qos_mismatch = false; - // sequence m_data - - - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -DdsTopic::~DdsTopic() -{ -} - -DdsTopic::DdsTopic( - const DdsTopic& x) -{ - m_name = x.m_name; - - - m_type_name = x.m_type_name; - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = x.m_data; - -} - -DdsTopic::DdsTopic( - DdsTopic&& x) noexcept -{ - m_name = std::move(x.m_name); - - - m_type_name = std::move(x.m_type_name); - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = std::move(x.m_data); - -} - -DdsTopic& DdsTopic::operator =( - const DdsTopic& x) -{ - m_name = x.m_name; - - - m_type_name = x.m_type_name; - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = x.m_data; - - return *this; -} - -DdsTopic& DdsTopic::operator =( - DdsTopic&& x) noexcept -{ - m_name = std::move(x.m_name); - - - m_type_name = std::move(x.m_type_name); - - - m_type_discovered = x.m_type_discovered; - - - m_type_mismatch = x.m_type_mismatch; - - - m_qos_mismatch = x.m_qos_mismatch; - - - m_data = std::move(x.m_data); - - return *this; -} - -bool DdsTopic::operator ==( - const DdsTopic& x) const -{ - return (m_name == x.m_name && - m_type_name == x.m_type_name && - m_type_discovered == x.m_type_discovered && - m_type_mismatch == x.m_type_mismatch && - m_qos_mismatch == x.m_qos_mismatch && - m_data == x.m_data); -} - -bool DdsTopic::operator !=( - const DdsTopic& x) const -{ - return !(*this == x); -} - -size_t DdsTopic::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return DdsTopic_max_cdr_typesize; -} - -size_t DdsTopic::getCdrSerializedSize( - const DdsTopic& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.name().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.type_name().size() + 1; - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for (size_t a = 0; a < data.data().size(); ++a) - { - current_alignment += DdsTopicData::getCdrSerializedSize(data.data().at(a), current_alignment); - } - - - - return current_alignment - initial_alignment; -} - -void DdsTopic::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_name.c_str(); - - scdr << m_type_name.c_str(); - - scdr << m_type_discovered; - - scdr << m_type_mismatch; - - scdr << m_qos_mismatch; - - scdr << m_data; - - -} - -void DdsTopic::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_name; - - - - dcdr >> m_type_name; - - - - dcdr >> m_type_discovered; - - - - dcdr >> m_type_mismatch; - - - - dcdr >> m_qos_mismatch; - - - - dcdr >> m_data; - - -} - -bool DdsTopic::isKeyDefined() -{ - return false; -} - -void DdsTopic::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member name - * @param _name New value to be copied in member name - */ -void DdsTopic::name( - const std::string& _name) -{ - m_name = _name; -} - -/*! - * @brief This function moves the value in member name - * @param _name New value to be moved in member name - */ -void DdsTopic::name( - std::string&& _name) -{ - m_name = std::move(_name); -} - -/*! - * @brief This function returns a constant reference to member name - * @return Constant reference to member name - */ -const std::string& DdsTopic::name() const -{ - return m_name; -} - -/*! - * @brief This function returns a reference to member name - * @return Reference to member name - */ -std::string& DdsTopic::name() -{ - return m_name; -} - -/*! - * @brief This function copies the value in member type_name - * @param _type_name New value to be copied in member type_name - */ -void DdsTopic::type_name( - const std::string& _type_name) -{ - m_type_name = _type_name; -} - -/*! - * @brief This function moves the value in member type_name - * @param _type_name New value to be moved in member type_name - */ -void DdsTopic::type_name( - std::string&& _type_name) -{ - m_type_name = std::move(_type_name); -} - -/*! - * @brief This function returns a constant reference to member type_name - * @return Constant reference to member type_name - */ -const std::string& DdsTopic::type_name() const -{ - return m_type_name; -} - -/*! - * @brief This function returns a reference to member type_name - * @return Reference to member type_name - */ -std::string& DdsTopic::type_name() -{ - return m_type_name; -} - -/*! - * @brief This function sets a value in member type_discovered - * @param _type_discovered New value for member type_discovered - */ -void DdsTopic::type_discovered( - bool _type_discovered) -{ - m_type_discovered = _type_discovered; -} - -/*! - * @brief This function returns the value of member type_discovered - * @return Value of member type_discovered - */ -bool DdsTopic::type_discovered() const -{ - return m_type_discovered; -} - -/*! - * @brief This function returns a reference to member type_discovered - * @return Reference to member type_discovered - */ -bool& DdsTopic::type_discovered() -{ - return m_type_discovered; -} - -/*! - * @brief This function sets a value in member type_mismatch - * @param _type_mismatch New value for member type_mismatch - */ -void DdsTopic::type_mismatch( - bool _type_mismatch) -{ - m_type_mismatch = _type_mismatch; -} - -/*! - * @brief This function returns the value of member type_mismatch - * @return Value of member type_mismatch - */ -bool DdsTopic::type_mismatch() const -{ - return m_type_mismatch; -} - -/*! - * @brief This function returns a reference to member type_mismatch - * @return Reference to member type_mismatch - */ -bool& DdsTopic::type_mismatch() -{ - return m_type_mismatch; -} - -/*! - * @brief This function sets a value in member qos_mismatch - * @param _qos_mismatch New value for member qos_mismatch - */ -void DdsTopic::qos_mismatch( - bool _qos_mismatch) -{ - m_qos_mismatch = _qos_mismatch; -} - -/*! - * @brief This function returns the value of member qos_mismatch - * @return Value of member qos_mismatch - */ -bool DdsTopic::qos_mismatch() const -{ - return m_qos_mismatch; -} - -/*! - * @brief This function returns a reference to member qos_mismatch - * @return Reference to member qos_mismatch - */ -bool& DdsTopic::qos_mismatch() -{ - return m_qos_mismatch; -} - -/*! - * @brief This function copies the value in member data - * @param _data New value to be copied in member data - */ -void DdsTopic::data( - const std::vector& _data) -{ - m_data = _data; -} - -/*! - * @brief This function moves the value in member data - * @param _data New value to be moved in member data - */ -void DdsTopic::data( - std::vector&& _data) -{ - m_data = std::move(_data); -} - -/*! - * @brief This function returns a constant reference to member data - * @return Constant reference to member data - */ -const std::vector& DdsTopic::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -std::vector& DdsTopic::data() -{ - return m_data; -} - -MonitoringTopics::MonitoringTopics() -{ - // sequence m_topics - - - // Just to register all known types - registerMonitoringTopicsTypes(); -} - -MonitoringTopics::~MonitoringTopics() -{ -} - -MonitoringTopics::MonitoringTopics( - const MonitoringTopics& x) -{ - m_topics = x.m_topics; - -} - -MonitoringTopics::MonitoringTopics( - MonitoringTopics&& x) noexcept -{ - m_topics = std::move(x.m_topics); - -} - -MonitoringTopics& MonitoringTopics::operator =( - const MonitoringTopics& x) -{ - m_topics = x.m_topics; - - return *this; -} - -MonitoringTopics& MonitoringTopics::operator =( - MonitoringTopics&& x) noexcept -{ - m_topics = std::move(x.m_topics); - - return *this; -} - -bool MonitoringTopics::operator ==( - const MonitoringTopics& x) const -{ - return (m_topics == x.m_topics); -} - -bool MonitoringTopics::operator !=( - const MonitoringTopics& x) const -{ - return !(*this == x); -} - -size_t MonitoringTopics::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return MonitoringTopics_max_cdr_typesize; -} - -size_t MonitoringTopics::getCdrSerializedSize( - const MonitoringTopics& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for (size_t a = 0; a < data.topics().size(); ++a) - { - current_alignment += DdsTopic::getCdrSerializedSize(data.topics().at(a), current_alignment); - } - - - - return current_alignment - initial_alignment; -} - -void MonitoringTopics::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_topics; - - -} - -void MonitoringTopics::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_topics; - - -} - -bool MonitoringTopics::isKeyDefined() -{ - return false; -} - -void MonitoringTopics::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member topics - * @param _topics New value to be copied in member topics - */ -void MonitoringTopics::topics( - const std::vector& _topics) -{ - m_topics = _topics; -} - -/*! - * @brief This function moves the value in member topics - * @param _topics New value to be moved in member topics - */ -void MonitoringTopics::topics( - std::vector&& _topics) -{ - m_topics = std::move(_topics); -} - -/*! - * @brief This function returns a constant reference to member topics - * @return Constant reference to member topics - */ -const std::vector& MonitoringTopics::topics() const -{ - return m_topics; -} - -/*! - * @brief This function returns a reference to member topics - * @return Reference to member topics - */ -std::vector& MonitoringTopics::topics() -{ - return m_topics; -} - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt b/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt index fd153500..fc80a4f8 100644 --- a/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt +++ b/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt @@ -26,7 +26,7 @@ file( ) # Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) +if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") else() list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") @@ -45,7 +45,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/dynamic/allowed_topic_list/CMakeLists.txt b/ddspipe_core/test/unittest/dynamic/allowed_topic_list/CMakeLists.txt index 4edef040..ae0b1041 100644 --- a/ddspipe_core/test/unittest/dynamic/allowed_topic_list/CMakeLists.txt +++ b/ddspipe_core/test/unittest/dynamic/allowed_topic_list/CMakeLists.txt @@ -41,7 +41,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/dynamic/participants_database/CMakeLists.txt b/ddspipe_core/test/unittest/dynamic/participants_database/CMakeLists.txt index bf91b850..49fb729c 100644 --- a/ddspipe_core/test/unittest/dynamic/participants_database/CMakeLists.txt +++ b/ddspipe_core/test/unittest/dynamic/participants_database/CMakeLists.txt @@ -39,7 +39,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/efficiency/CMakeLists.txt b/ddspipe_core/test/unittest/efficiency/CMakeLists.txt index ed0d0811..1dfa874e 100644 --- a/ddspipe_core/test/unittest/efficiency/CMakeLists.txt +++ b/ddspipe_core/test/unittest/efficiency/CMakeLists.txt @@ -37,7 +37,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) @@ -73,7 +73,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) @@ -109,7 +109,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt b/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt index 657393a5..6e99dbd4 100644 --- a/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt +++ b/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt @@ -26,7 +26,7 @@ file( ) # Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) +if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") else() list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") @@ -44,7 +44,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp index 126be167..d6d8acc0 100644 --- a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp +++ b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp @@ -34,15 +34,9 @@ #include #include -#if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) - #include - #include - #include -#else - #include - #include - #include -#endif // if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) +#include +#include +#include #include "../constants.hpp" @@ -145,7 +139,7 @@ TEST_F(DdsLogConsumerTest, publish_logs) ASSERT_TRUE(reader_->wait_for_unread_message(test::logging::MAX_WAITING_TIME)); // Verify that the content of the LogEntry published by the Log is correct - ASSERT_EQ(reader_->take_next_sample(&entry, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&entry, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); ASSERT_EQ(entry.event(), UNDEFINED); @@ -163,7 +157,7 @@ TEST_F(DdsLogConsumerTest, publish_logs) ASSERT_TRUE(reader_->wait_for_unread_message(test::logging::MAX_WAITING_TIME)); // Verify that the content of the LogEntry published by the Log is correct - ASSERT_EQ(reader_->take_next_sample(&entry, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&entry, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); ASSERT_EQ(entry.event(), UNDEFINED); @@ -181,7 +175,7 @@ TEST_F(DdsLogConsumerTest, publish_logs) ASSERT_TRUE(reader_->wait_for_unread_message(test::logging::MAX_WAITING_TIME)); // Verify that the content of the LogEntry published by the Log is correct - ASSERT_EQ(reader_->take_next_sample(&entry, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&entry, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); ASSERT_EQ(entry.event(), UNDEFINED); @@ -239,7 +233,7 @@ TEST_F(DdsLogConsumerTest, dont_publish_logs) ASSERT_FALSE(reader_->wait_for_unread_message(test::logging::MAX_WAITING_TIME)); // Verify that the content of the LogEntry published by the Log is correct - ASSERT_EQ(reader_->take_next_sample(&entry, &info), ReturnCode_t::RETCODE_NO_DATA); + ASSERT_EQ(reader_->take_next_sample(&entry, &info), RETCODE_NO_DATA); } // WARNING @@ -251,7 +245,7 @@ TEST_F(DdsLogConsumerTest, dont_publish_logs) ASSERT_FALSE(reader_->wait_for_unread_message(test::logging::MAX_WAITING_TIME)); // Verify that the content of the LogEntry published by the Log is correct - ASSERT_EQ(reader_->take_next_sample(&entry, &info), ReturnCode_t::RETCODE_NO_DATA); + ASSERT_EQ(reader_->take_next_sample(&entry, &info), RETCODE_NO_DATA); } // ERROR @@ -263,7 +257,7 @@ TEST_F(DdsLogConsumerTest, dont_publish_logs) ASSERT_FALSE(reader_->wait_for_unread_message(test::logging::MAX_WAITING_TIME)); // Verify that the content of the LogEntry published by the Log is correct - ASSERT_EQ(reader_->take_next_sample(&entry, &info), ReturnCode_t::RETCODE_NO_DATA); + ASSERT_EQ(reader_->take_next_sample(&entry, &info), RETCODE_NO_DATA); } utils::Log::ClearConsumers(); diff --git a/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt b/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt index 696a238d..f765c238 100644 --- a/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt +++ b/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt @@ -26,7 +26,7 @@ file( ) # Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) +if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") else() list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") @@ -44,7 +44,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt index cb87fdbf..330353dc 100644 --- a/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt @@ -26,7 +26,7 @@ file( ) # Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) +if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") else() list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") @@ -44,7 +44,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp b/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp index 1777be12..357ca0cb 100644 --- a/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp +++ b/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp @@ -29,13 +29,8 @@ #include #include -#if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) - #include - #include -#else - #include - #include -#endif // if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) +#include +#include #include "../../constants.hpp" @@ -131,7 +126,7 @@ TEST_F(DdsMonitorStatusTest, type_mismatch) // Wait for the monitor to publish the next message ASSERT_TRUE(reader_->wait_for_unread_message(test::monitor::MAX_WAITING_TIME)); - ASSERT_EQ(reader_->take_next_sample(&status, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&status, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); // Verify that the content of the MonitoringStatus published by the Monitor is correct @@ -157,7 +152,7 @@ TEST_F(DdsMonitorStatusTest, qos_mismatch) // Wait for the monitor to publish the next message ASSERT_TRUE(reader_->wait_for_unread_message(test::monitor::MAX_WAITING_TIME)); - ASSERT_EQ(reader_->take_next_sample(&status, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&status, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); // Verify that the content of the MonitoringStatus published by the Monitor is correct diff --git a/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt index cf96873f..904717a6 100644 --- a/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt @@ -26,7 +26,7 @@ file( ) # Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) +if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") else() list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") @@ -44,7 +44,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt index 7393215e..defe40e0 100644 --- a/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt @@ -26,7 +26,7 @@ file( ) # Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) +if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") else() list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") @@ -47,7 +47,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp b/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp index 2b624fa0..beb4dcd2 100644 --- a/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp +++ b/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp @@ -31,13 +31,8 @@ #include #include -#if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) - #include - #include -#else - #include - #include -#endif // if FASTRTPS_VERSION_MAJOR < 2 || (FASTRTPS_VERSION_MAJOR == 2 && FASTRTPS_VERSION_MINOR < 13) +#include +#include #include "../../constants.hpp" @@ -143,7 +138,7 @@ TEST_F(DdsMonitorTopicsTest, msgs_received) // Wait for the monitor to publish the next message ASSERT_TRUE(reader_->wait_for_unread_message(test::monitor::MAX_WAITING_TIME)); - ASSERT_EQ(reader_->take_next_sample(&topics, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&topics, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); ASSERT_EQ(topics.topics().size(), 1); @@ -175,7 +170,7 @@ TEST_F(DdsMonitorTopicsTest, msgs_lost) // Wait for the monitor to publish the next message ASSERT_TRUE(reader_->wait_for_unread_message(test::monitor::MAX_WAITING_TIME)); - ASSERT_EQ(reader_->take_next_sample(&topics, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&topics, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); // Verify that the content of the MonitoringTopics published by the Monitor is correct @@ -211,7 +206,7 @@ TEST_F(DdsMonitorTopicsTest, type_discovered) // Wait for the monitor to publish the next message ASSERT_TRUE(reader_->wait_for_unread_message(test::monitor::MAX_WAITING_TIME)); - ASSERT_EQ(reader_->take_next_sample(&topics, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&topics, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); // Verify that the content of the MonitoringTopics published by the Monitor is correct @@ -244,7 +239,7 @@ TEST_F(DdsMonitorTopicsTest, type_mismatch) // Wait for the monitor to publish the next message ASSERT_TRUE(reader_->wait_for_unread_message(test::monitor::MAX_WAITING_TIME)); - ASSERT_EQ(reader_->take_next_sample(&topics, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&topics, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); // Verify that the content of the MonitoringTopics published by the Monitor is correct @@ -274,7 +269,7 @@ TEST_F(DdsMonitorTopicsTest, qos_mismatch) // Wait for the monitor to publish the next message ASSERT_TRUE(reader_->wait_for_unread_message(test::monitor::MAX_WAITING_TIME)); - ASSERT_EQ(reader_->take_next_sample(&topics, &info), ReturnCode_t::RETCODE_OK); + ASSERT_EQ(reader_->take_next_sample(&topics, &info), RETCODE_OK); ASSERT_EQ(info.instance_state, ALIVE_INSTANCE_STATE); // Verify that the content of the MonitoringTopics published by the Monitor is correct diff --git a/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt index 52f890ab..b32d40fc 100644 --- a/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt @@ -26,7 +26,7 @@ file( ) # Exclude types' files depending on the Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) +if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") else() list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") @@ -47,7 +47,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt b/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt index 7417fe5f..d3308625 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt +++ b/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt @@ -18,15 +18,8 @@ set(TEST_NAME dtypes_idl_tests) -# Determine Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) - set(DDS_TYPES_VERSION "v1") -else() - set(DDS_TYPES_VERSION "v2") -endif() - # Add to test sources every FastDDSGen file generated -file(GLOB DATATYPE_SOURCES_CXX "types/${DDS_TYPES_VERSION}/**/*.cxx") +file(GLOB DATATYPE_SOURCES_CXX "types/**/*.cxx") set(TEST_SOURCES dtypes_idl_tests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/dynamic_types/schema_idl.cpp @@ -38,7 +31,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils $<$:iphlpapi$Shlwapi> ) @@ -49,7 +42,7 @@ file( RESULT_SOURCES_IDL RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "types/${DDS_TYPES_VERSION}/idls/*.idl") + "types/idls/*.idl") set(TEST_NEEDED_SOURCES ${RESULT_SOURCES_IDL} @@ -70,7 +63,7 @@ add_unittest_executable( set(TEST_NAME dtypes_msg_tests) # Add to test sources every FastDDSGen file generated -file(GLOB DATATYPE_SOURCES_CXX "types/${DDS_TYPES_VERSION}/**/*.cxx") +file(GLOB DATATYPE_SOURCES_CXX "types/**/*.cxx") set(TEST_SOURCES dtypes_msg_tests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/dynamic_types/schema_msg.cpp @@ -82,7 +75,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils $<$:iphlpapi$Shlwapi> ) @@ -93,7 +86,7 @@ file( RESULT_SOURCES_MSG RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "types/${DDS_TYPES_VERSION}/msgs/*.msg") + "types/msgs/*.msg") set(TEST_NEEDED_SOURCES ${RESULT_SOURCES_MSG} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp index 401fe14e..c4c15009 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp @@ -20,15 +20,11 @@ #include #include -#include +#include #include -#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 - #include "types/v1/all_types.hpp" -#else - #include "types/v2/all_types.hpp" -#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 +#include "types/all_types.hpp" using namespace eprosima; @@ -43,11 +39,7 @@ std::string read_idl_from_file_( std::string file_name_by_type( SupportedType type) { - #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 - return std::string("types/v1/idls/") + to_string(type) + ".idl"; - #else - return std::string("types/v2/idls/") + to_string(type) + ".idl"; - #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + return std::string("types/idls/") + to_string(type) + ".idl"; } void compare_schemas( @@ -64,7 +56,7 @@ void execute_test_by_type( std::string idl_file = read_idl_from_file_(file_name_by_type(type)); // Get Dynamic type - fastrtps::types::DynamicType_ptr dyn_type = get_dynamic_type(type); + fastdds::dds::DynamicType::_ref_type dyn_type = get_dynamic_type(type); // Get schema generated std::string schema = ddspipe::core::types::idl::generate_idl_schema(dyn_type); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp index 79f31941..751fdcf9 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp @@ -17,13 +17,9 @@ #include #include #include -#include +#include #include -#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 - #include "types/v1/all_types.hpp" -#else - #include "types/v2/all_types.hpp" -#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 +#include "types/all_types.hpp" using namespace eprosima; @@ -38,11 +34,7 @@ std::string read_msg_from_file_( std::string file_name_by_type( SupportedType type) { - #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 - return std::string("types/v1/msgs/") + to_string(type) + ".msg"; - #else - return std::string("types/v2/msgs/") + to_string(type) + ".msg"; - #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 + return std::string("types/msgs/") + to_string(type) + ".msg"; } void compare_schemas( @@ -59,7 +51,7 @@ void execute_test_by_type( std::string msg_file = read_msg_from_file_(file_name_by_type(type)); // Get Dynamic type - fastrtps::types::DynamicType_ptr dyn_type = get_dynamic_type(type); + fastdds::dds::DynamicType::_ref_type dyn_type = get_dynamic_type(type); // Get schema generated std::string schema = ddspipe::core::types::msg::generate_ros2_schema(dyn_type); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp new file mode 100644 index 00000000..4b143191 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp @@ -0,0 +1,96 @@ +// Copyright 2022 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 all_types.hpp + */ + +/* + * USEFUL COMMAND + * + * for TYPE in hello_world numeric_array char_sequence basic_struct basic_array_struct float_bounded_sequence arrays_and_sequences complex_nested_arrays; do ${FASTDDSGEN_WS}/scripts/fastddsgen -replace -d ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/type_objects/ -typeobject -cs ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/idls/${TYPE}.idl; done + */ + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "type_objects/hello_worldTypeObjectSupport.hpp" +#include "type_objects/numeric_arrayTypeObjectSupport.hpp" +#include "type_objects/char_sequenceTypeObjectSupport.hpp" +#include "type_objects/basic_structTypeObjectSupport.hpp" +#include "type_objects/basic_array_structTypeObjectSupport.hpp" +#include "type_objects/float_bounded_sequenceTypeObjectSupport.hpp" +#include "type_objects/arrays_and_sequencesTypeObjectSupport.hpp" +#include "type_objects/complex_nested_arraysTypeObjectSupport.hpp" +#include "type_objects/enum_structTypeObjectSupport.hpp" +#include "type_objects/union_structTypeObjectSupport.hpp" +#include "type_objects/map_structTypeObjectSupport.hpp" + +namespace test { + +ENUMERATION_BUILDER( + SupportedType, + hello_world, + numeric_array, + char_sequence, + basic_struct, + basic_array_struct, + float_bounded_sequence, + arrays_and_sequences, + complex_nested_arrays, + enum_struct, + union_struct, // NOTE: default case currently not supported in dynamic types + map_struct + ); + +eprosima::fastdds::dds::DynamicType::_ref_type get_dynamic_type( // traits::ref_type + SupportedType type) +{ + register_hello_world_type_objects(); + register_numeric_array_type_objects(); + register_char_sequence_type_objects(); + register_basic_struct_type_objects(); + register_basic_array_struct_type_objects(); + register_float_bounded_sequence_type_objects(); + register_arrays_and_sequences_type_objects(); + register_complex_nested_arrays_type_objects(); + register_enum_struct_type_objects(); + register_union_struct_type_objects(); + register_map_struct_type_objects(); + + auto type_name = to_string(type); + eprosima::fastdds::dds::xtypes::TypeObjectPair type_objects; + const auto ret = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_objects( + type_name, + type_objects); + + if (ret != eprosima::fastdds::dds::RETCODE_OK) + { + throw eprosima::utils::InconsistencyException("No Type Object"); + } + + return eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(type_objects.complete_type_object)->build(); +} + +} /* namespace test */ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/arrays_and_sequences.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/arrays_and_sequences.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/basic_array_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/basic_array_struct.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/basic_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/basic_struct.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/char_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/char_sequence.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/complex_nested_arrays.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/complex_nested_arrays.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/enum_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/enum_struct.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/enum_struct.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/enum_struct.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/float_bounded_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/float_bounded_sequence.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/hello_world.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/hello_world.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/map_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/map_struct.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/map_struct.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/map_struct.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/numeric_array.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/numeric_array.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/union_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/union_struct.idl similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/idls/union_struct.idl rename to ddspipe_core/test/unittest/types/dynamic_types/types/idls/union_struct.idl diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/arrays_and_sequences.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/arrays_and_sequences.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/basic_array_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/basic_array_struct.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/basic_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/basic_struct.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/char_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/char_sequence.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/complex_nested_arrays.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/complex_nested_arrays.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/float_bounded_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/float_bounded_sequence.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/hello_world.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/hello_world.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/numeric_array.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg similarity index 100% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v1/msgs/numeric_array.msg rename to ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequences.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp similarity index 66% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequences.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp index cf8bc69f..eff9b5ef 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequences.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp @@ -13,32 +13,20 @@ // limitations under the License. /*! - * @file arrays_and_sequences.h + * @file arrays_and_sequences.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "arrays_and_sequencesv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ +#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_HPP_ +#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_HPP_ #include -#include #include -#include -#include +#include #include -#include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +52,6 @@ #define ARRAYS_AND_SEQUENCES_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure AnInternalObject defined by the user in the IDL file. * @ingroup arrays_and_sequences @@ -86,73 +63,117 @@ class AnInternalObject /*! * @brief Default constructor. */ - eProsima_user_DllExport AnInternalObject(); + eProsima_user_DllExport AnInternalObject() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~AnInternalObject(); + eProsima_user_DllExport ~AnInternalObject() + { + } /*! * @brief Copy constructor. * @param x Reference to the object AnInternalObject that will be copied. */ eProsima_user_DllExport AnInternalObject( - const AnInternalObject& x); + const AnInternalObject& x) + { + m_x = x.m_x; + + m_positive = x.m_positive; + + } /*! * @brief Move constructor. * @param x Reference to the object AnInternalObject that will be copied. */ eProsima_user_DllExport AnInternalObject( - AnInternalObject&& x) noexcept; + AnInternalObject&& x) noexcept + { + m_x = x.m_x; + m_positive = x.m_positive; + } /*! * @brief Copy assignment. * @param x Reference to the object AnInternalObject that will be copied. */ eProsima_user_DllExport AnInternalObject& operator =( - const AnInternalObject& x); + const AnInternalObject& x) + { + + m_x = x.m_x; + + m_positive = x.m_positive; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object AnInternalObject that will be copied. */ eProsima_user_DllExport AnInternalObject& operator =( - AnInternalObject&& x) noexcept; + AnInternalObject&& x) noexcept + { + + m_x = x.m_x; + m_positive = x.m_positive; + return *this; + } /*! * @brief Comparison operator. * @param x AnInternalObject object to compare. */ eProsima_user_DllExport bool operator ==( - const AnInternalObject& x) const; + const AnInternalObject& x) const + { + return (m_x == x.m_x && + m_positive == x.m_positive); + } /*! * @brief Comparison operator. * @param x AnInternalObject object to compare. */ eProsima_user_DllExport bool operator !=( - const AnInternalObject& x) const; + const AnInternalObject& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member x * @param _x New value for member x */ eProsima_user_DllExport void x( - float _x); + float _x) + { + m_x = _x; + } /*! * @brief This function returns the value of member x * @return Value of member x */ - eProsima_user_DllExport float x() const; + eProsima_user_DllExport float x() const + { + return m_x; + } /*! * @brief This function returns a reference to member x * @return Reference to member x */ - eProsima_user_DllExport float& x(); + eProsima_user_DllExport float& x() + { + return m_x; + } /*! @@ -160,19 +181,30 @@ class AnInternalObject * @param _positive New value for member positive */ eProsima_user_DllExport void positive( - bool _positive); + bool _positive) + { + m_positive = _positive; + } /*! * @brief This function returns the value of member positive * @return Value of member positive */ - eProsima_user_DllExport bool positive() const; + eProsima_user_DllExport bool positive() const + { + return m_positive; + } /*! * @brief This function returns a reference to member positive * @return Reference to member positive */ - eProsima_user_DllExport bool& positive(); + eProsima_user_DllExport bool& positive() + { + return m_positive; + } + + private: @@ -180,8 +212,6 @@ class AnInternalObject bool m_positive{false}; }; - - /*! * @brief This class represents the structure arrays_and_sequences defined by the user in the IDL file. * @ingroup arrays_and_sequences @@ -193,80 +223,134 @@ class arrays_and_sequences /*! * @brief Default constructor. */ - eProsima_user_DllExport arrays_and_sequences(); + eProsima_user_DllExport arrays_and_sequences() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~arrays_and_sequences(); + eProsima_user_DllExport ~arrays_and_sequences() + { + } /*! * @brief Copy constructor. * @param x Reference to the object arrays_and_sequences that will be copied. */ eProsima_user_DllExport arrays_and_sequences( - const arrays_and_sequences& x); + const arrays_and_sequences& x) + { + m_unlimited_vector = x.m_unlimited_vector; + + m_limited_vector = x.m_limited_vector; + + m_limited_array = x.m_limited_array; + + } /*! * @brief Move constructor. * @param x Reference to the object arrays_and_sequences that will be copied. */ eProsima_user_DllExport arrays_and_sequences( - arrays_and_sequences&& x) noexcept; + arrays_and_sequences&& x) noexcept + { + m_unlimited_vector = std::move(x.m_unlimited_vector); + m_limited_vector = std::move(x.m_limited_vector); + m_limited_array = std::move(x.m_limited_array); + } /*! * @brief Copy assignment. * @param x Reference to the object arrays_and_sequences that will be copied. */ eProsima_user_DllExport arrays_and_sequences& operator =( - const arrays_and_sequences& x); + const arrays_and_sequences& x) + { + + m_unlimited_vector = x.m_unlimited_vector; + + m_limited_vector = x.m_limited_vector; + + m_limited_array = x.m_limited_array; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object arrays_and_sequences that will be copied. */ eProsima_user_DllExport arrays_and_sequences& operator =( - arrays_and_sequences&& x) noexcept; + arrays_and_sequences&& x) noexcept + { + + m_unlimited_vector = std::move(x.m_unlimited_vector); + m_limited_vector = std::move(x.m_limited_vector); + m_limited_array = std::move(x.m_limited_array); + return *this; + } /*! * @brief Comparison operator. * @param x arrays_and_sequences object to compare. */ eProsima_user_DllExport bool operator ==( - const arrays_and_sequences& x) const; + const arrays_and_sequences& x) const + { + return (m_unlimited_vector == x.m_unlimited_vector && + m_limited_vector == x.m_limited_vector && + m_limited_array == x.m_limited_array); + } /*! * @brief Comparison operator. * @param x arrays_and_sequences object to compare. */ eProsima_user_DllExport bool operator !=( - const arrays_and_sequences& x) const; + const arrays_and_sequences& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member unlimited_vector * @param _unlimited_vector New value to be copied in member unlimited_vector */ eProsima_user_DllExport void unlimited_vector( - const std::vector& _unlimited_vector); + const std::vector& _unlimited_vector) + { + m_unlimited_vector = _unlimited_vector; + } /*! * @brief This function moves the value in member unlimited_vector * @param _unlimited_vector New value to be moved in member unlimited_vector */ eProsima_user_DllExport void unlimited_vector( - std::vector&& _unlimited_vector); + std::vector&& _unlimited_vector) + { + m_unlimited_vector = std::move(_unlimited_vector); + } /*! * @brief This function returns a constant reference to member unlimited_vector * @return Constant reference to member unlimited_vector */ - eProsima_user_DllExport const std::vector& unlimited_vector() const; + eProsima_user_DllExport const std::vector& unlimited_vector() const + { + return m_unlimited_vector; + } /*! * @brief This function returns a reference to member unlimited_vector * @return Reference to member unlimited_vector */ - eProsima_user_DllExport std::vector& unlimited_vector(); + eProsima_user_DllExport std::vector& unlimited_vector() + { + return m_unlimited_vector; + } /*! @@ -274,26 +358,38 @@ class arrays_and_sequences * @param _limited_vector New value to be copied in member limited_vector */ eProsima_user_DllExport void limited_vector( - const std::vector& _limited_vector); + const std::vector& _limited_vector) + { + m_limited_vector = _limited_vector; + } /*! * @brief This function moves the value in member limited_vector * @param _limited_vector New value to be moved in member limited_vector */ eProsima_user_DllExport void limited_vector( - std::vector&& _limited_vector); + std::vector&& _limited_vector) + { + m_limited_vector = std::move(_limited_vector); + } /*! * @brief This function returns a constant reference to member limited_vector * @return Constant reference to member limited_vector */ - eProsima_user_DllExport const std::vector& limited_vector() const; + eProsima_user_DllExport const std::vector& limited_vector() const + { + return m_limited_vector; + } /*! * @brief This function returns a reference to member limited_vector * @return Reference to member limited_vector */ - eProsima_user_DllExport std::vector& limited_vector(); + eProsima_user_DllExport std::vector& limited_vector() + { + return m_limited_vector; + } /*! @@ -301,26 +397,40 @@ class arrays_and_sequences * @param _limited_array New value to be copied in member limited_array */ eProsima_user_DllExport void limited_array( - const std::array& _limited_array); + const std::array& _limited_array) + { + m_limited_array = _limited_array; + } /*! * @brief This function moves the value in member limited_array * @param _limited_array New value to be moved in member limited_array */ eProsima_user_DllExport void limited_array( - std::array&& _limited_array); + std::array&& _limited_array) + { + m_limited_array = std::move(_limited_array); + } /*! * @brief This function returns a constant reference to member limited_array * @return Constant reference to member limited_array */ - eProsima_user_DllExport const std::array& limited_array() const; + eProsima_user_DllExport const std::array& limited_array() const + { + return m_limited_array; + } /*! * @brief This function returns a reference to member limited_array * @return Reference to member limited_array */ - eProsima_user_DllExport std::array& limited_array(); + eProsima_user_DllExport std::array& limited_array() + { + return m_limited_array; + } + + private: @@ -330,8 +440,6 @@ class arrays_and_sequences }; -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ - +#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp index adbc610d..a8be1936 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_HPP_ #define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_HPP_ -#include "arrays_and_sequences.h" +#include "arrays_and_sequences.hpp" constexpr uint32_t arrays_and_sequences_max_cdr_typesize {261UL}; constexpr uint32_t arrays_and_sequences_max_key_cdr_typesize {0UL}; @@ -37,14 +37,10 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const AnInternalObject& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const arrays_and_sequences& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp index e9c3ff29..d5d27a39 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -120,8 +118,6 @@ void serialize_key( } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx index c79cb323..ea826829 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx @@ -19,18 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "arrays_and_sequencesPubSubTypes.h" +#include #include -#include "arrays_and_sequencesPubSubTypes.h" #include "arrays_and_sequencesCdrAux.hpp" +#include "arrays_and_sequencesTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - AnInternalObjectPubSubType::AnInternalObjectPubSubType() { setName("AnInternalObject"); @@ -219,7 +219,10 @@ bool AnInternalObjectPubSubType::getKey( return true; } - +void AnInternalObjectPubSubType::register_type_object_representation() const +{ + register_arrays_and_sequences_type_objects(); +} arrays_and_sequencesPubSubType::arrays_and_sequencesPubSubType() { @@ -409,3 +412,11 @@ bool arrays_and_sequencesPubSubType::getKey( return true; } +void arrays_and_sequencesPubSubType::register_type_object_representation() const +{ + register_arrays_and_sequences_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "arrays_and_sequencesCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h index e7c10171..ff8fc7e7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "arrays_and_sequences.h" +#include "arrays_and_sequences.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type AnInternalObject defined by the user in the IDL file. * @ingroup arrays_and_sequences @@ -90,6 +88,9 @@ class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -128,8 +129,6 @@ class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType }; - - /*! * @brief This class represents the TopicDataType of the type arrays_and_sequences defined by the user in the IDL file. * @ingroup arrays_and_sequences @@ -180,6 +179,9 @@ class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataT eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx new file mode 100644 index 00000000..d0177d64 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx @@ -0,0 +1,1176 @@ +// 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 arrays_and_sequencesTypeObjectSupport.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. + */ + +#include "arrays_and_sequencesTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "arrays_and_sequences.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_arrays_and_sequences_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_AnInternalObject_type_identifier(); + + register_arrays_and_sequences_type_identifier(); + + }); +} + +void register_AnInternalObject_type_identifier() +{ + { + StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_AnInternalObject; + TypeIdentifierPair type_ids_AnInternalObject; + QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; + eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; + eprosima::fastcdr::optional ann_custom_AnInternalObject; + CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); + CompleteStructHeader header_AnInternalObject; + header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); + CompleteStructMemberSeq member_seq_AnInternalObject; + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); + } + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_positive; + MemberId member_id_positive = 0x00000001; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); + } + CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject already registered in TypeObjectRegistry for a different type."); + } + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_AnInternalObject); + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_arrays_and_sequences_type_identifier() +{ + { + StructTypeFlag struct_flags_arrays_and_sequences = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_arrays_and_sequences; + TypeIdentifierPair type_ids_arrays_and_sequences; + QualifiedTypeName type_name_arrays_and_sequences = "arrays_and_sequences"; + eprosima::fastcdr::optional type_ann_builtin_arrays_and_sequences; + eprosima::fastcdr::optional ann_custom_arrays_and_sequences; + CompleteTypeDetail detail_arrays_and_sequences = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_arrays_and_sequences, ann_custom_arrays_and_sequences, type_name_arrays_and_sequences.to_string()); + CompleteStructHeader header_arrays_and_sequences; + header_arrays_and_sequences = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_arrays_and_sequences); + CompleteStructMemberSeq member_seq_arrays_and_sequences; + { + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_AnInternalObject_unbounded", type_ids_arrays_and_sequences); + + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_arrays_and_sequences); + + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_AnInternalObject; + TypeIdentifierPair type_ids_AnInternalObject; + QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; + eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; + eprosima::fastcdr::optional ann_custom_AnInternalObject; + CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); + CompleteStructHeader header_AnInternalObject; + header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); + CompleteStructMemberSeq member_seq_AnInternalObject; + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); + } + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_positive; + MemberId member_id_positive = 0x00000001; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); + } + CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject already registered in TypeObjectRegistry for a different type."); + } + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_AnInternalObject); + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_AnInternalObject_unbounded = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_AnInternalObject_unbounded = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_AnInternalObject_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_unbounded, element_flags_anonymous_sequence_AnInternalObject_unbounded); + std::string type_id_kind_anonymous_sequence_AnInternalObject_unbounded("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_AnInternalObject_unbounded == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_AnInternalObject_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_AnInternalObject_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_AnInternalObject_unbounded", type_ids_arrays_and_sequences); + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_unlimited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_unlimited_vector; + MemberId member_id_unlimited_vector = 0x00000000; + if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_unlimited_vector = TypeObjectUtils::build_common_struct_member(member_id_unlimited_vector, member_flags_unlimited_vector, type_ids_arrays_and_sequences.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_unlimited_vector = TypeObjectUtils::build_common_struct_member(member_id_unlimited_vector, member_flags_unlimited_vector, type_ids_arrays_and_sequences.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure unlimited_vector member TypeIdentifier inconsistent."); + return; + } + MemberName name_unlimited_vector = "unlimited_vector"; + eprosima::fastcdr::optional member_ann_builtin_unlimited_vector; + ann_custom_arrays_and_sequences.reset(); + CompleteMemberDetail detail_unlimited_vector = TypeObjectUtils::build_complete_member_detail(name_unlimited_vector, member_ann_builtin_unlimited_vector, ann_custom_arrays_and_sequences); + CompleteStructMember member_unlimited_vector = TypeObjectUtils::build_complete_struct_member(common_unlimited_vector, detail_unlimited_vector); + TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_unlimited_vector); + } + { + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_AnInternalObject_10", type_ids_arrays_and_sequences); + + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_arrays_and_sequences); + + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_AnInternalObject; + TypeIdentifierPair type_ids_AnInternalObject; + QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; + eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; + eprosima::fastcdr::optional ann_custom_AnInternalObject; + CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); + CompleteStructHeader header_AnInternalObject; + header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); + CompleteStructMemberSeq member_seq_AnInternalObject; + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); + } + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_positive; + MemberId member_id_positive = 0x00000001; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); + } + CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject already registered in TypeObjectRegistry for a different type."); + } + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_AnInternalObject); + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_10 {nullptr}; + if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_COMPLETE; + if (TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_10 = 0; + PlainCollectionHeader header_anonymous_sequence_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_10, element_flags_anonymous_sequence_AnInternalObject_10); + std::string type_id_kind_anonymous_sequence_AnInternalObject_10("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_AnInternalObject_10 == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = static_cast(10); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_10, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_10)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_10")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 10; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_AnInternalObject_10, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_10)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_AnInternalObject_10")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_AnInternalObject_10", type_ids_arrays_and_sequences); + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_10: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_limited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_limited_vector; + MemberId member_id_limited_vector = 0x00000001; + if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_limited_vector = TypeObjectUtils::build_common_struct_member(member_id_limited_vector, member_flags_limited_vector, type_ids_arrays_and_sequences.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_limited_vector = TypeObjectUtils::build_common_struct_member(member_id_limited_vector, member_flags_limited_vector, type_ids_arrays_and_sequences.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure limited_vector member TypeIdentifier inconsistent."); + return; + } + MemberName name_limited_vector = "limited_vector"; + eprosima::fastcdr::optional member_ann_builtin_limited_vector; + ann_custom_arrays_and_sequences.reset(); + CompleteMemberDetail detail_limited_vector = TypeObjectUtils::build_complete_member_detail(name_limited_vector, member_ann_builtin_limited_vector, ann_custom_arrays_and_sequences); + CompleteStructMember member_limited_vector = TypeObjectUtils::build_complete_struct_member(common_limited_vector, detail_limited_vector); + TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_limited_vector); + } + { + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_AnInternalObject_10", type_ids_arrays_and_sequences); + + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_arrays_and_sequences); + + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_AnInternalObject; + TypeIdentifierPair type_ids_AnInternalObject; + QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; + eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; + eprosima::fastcdr::optional ann_custom_AnInternalObject; + CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); + CompleteStructHeader header_AnInternalObject; + header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); + CompleteStructMemberSeq member_seq_AnInternalObject; + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); + } + { + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_AnInternalObject); + + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_positive; + MemberId member_id_positive = 0x00000001; + if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); + } + CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject already registered in TypeObjectRegistry for a different type."); + } + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_AnInternalObject); + if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_array_AnInternalObject_10 {nullptr}; + if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_AnInternalObject_10 = EK_COMPLETE; + if (TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d()) + { + equiv_kind_anonymous_array_AnInternalObject_10 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_AnInternalObject_10 = 0; + PlainCollectionHeader header_anonymous_array_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_AnInternalObject_10, element_flags_anonymous_array_AnInternalObject_10); + std::string type_id_kind_anonymous_array_AnInternalObject_10("TI_PLAIN_ARRAY_SMALL"); + if (type_id_kind_anonymous_array_AnInternalObject_10 == "TI_PLAIN_ARRAY_SMALL") + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(10)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_AnInternalObject_10, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_AnInternalObject_10)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_AnInternalObject_10")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(10)); + + PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_AnInternalObject_10, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_AnInternalObject_10)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_AnInternalObject_10")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_AnInternalObject_10", type_ids_arrays_and_sequences); + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_AnInternalObject_10: Given Array TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_limited_array = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_limited_array; + MemberId member_id_limited_array = 0x00000002; + if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_limited_array = TypeObjectUtils::build_common_struct_member(member_id_limited_array, member_flags_limited_array, type_ids_arrays_and_sequences.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && + (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_limited_array = TypeObjectUtils::build_common_struct_member(member_id_limited_array, member_flags_limited_array, type_ids_arrays_and_sequences.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure limited_array member TypeIdentifier inconsistent."); + return; + } + MemberName name_limited_array = "limited_array"; + eprosima::fastcdr::optional member_ann_builtin_limited_array; + ann_custom_arrays_and_sequences.reset(); + CompleteMemberDetail detail_limited_array = TypeObjectUtils::build_complete_member_detail(name_limited_array, member_ann_builtin_limited_array, ann_custom_arrays_and_sequences); + CompleteStructMember member_limited_array = TypeObjectUtils::build_complete_struct_member(common_limited_array, detail_limited_array); + TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_limited_array); + } + CompleteStructType struct_type_arrays_and_sequences = TypeObjectUtils::build_complete_struct_type(struct_flags_arrays_and_sequences, header_arrays_and_sequences, member_seq_arrays_and_sequences); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_arrays_and_sequences, type_name_arrays_and_sequences.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "arrays_and_sequences already registered in TypeObjectRegistry for a different type."); + } + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "arrays_and_sequences", type_ids_arrays_and_sequences); + if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "arrays_and_sequences: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp new file mode 100644 index 00000000..fd4c5e4b --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp @@ -0,0 +1,61 @@ +// 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 arrays_and_sequencesTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_arrays_and_sequences_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register AnInternalObject related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_AnInternalObject_type_identifier(); +/** + * @brief Register arrays_and_sequences related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_arrays_and_sequences_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp similarity index 67% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_struct.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp index a8aa5e9d..bd064fe7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_struct.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp @@ -13,32 +13,18 @@ // limitations under the License. /*! - * @file basic_array_struct.h + * @file basic_array_struct.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "basic_array_structv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ +#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_HPP_ +#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_HPP_ #include -#include #include -#include -#include -#include - -#include -#include -#include - - +#include #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +50,6 @@ #define BASIC_ARRAY_STRUCT_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure TheOtherObjectInArray defined by the user in the IDL file. * @ingroup basic_array_struct @@ -86,73 +61,117 @@ class TheOtherObjectInArray /*! * @brief Default constructor. */ - eProsima_user_DllExport TheOtherObjectInArray(); + eProsima_user_DllExport TheOtherObjectInArray() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~TheOtherObjectInArray(); + eProsima_user_DllExport ~TheOtherObjectInArray() + { + } /*! * @brief Copy constructor. * @param x Reference to the object TheOtherObjectInArray that will be copied. */ eProsima_user_DllExport TheOtherObjectInArray( - const TheOtherObjectInArray& x); + const TheOtherObjectInArray& x) + { + m_some_num = x.m_some_num; + + m_positive = x.m_positive; + + } /*! * @brief Move constructor. * @param x Reference to the object TheOtherObjectInArray that will be copied. */ eProsima_user_DllExport TheOtherObjectInArray( - TheOtherObjectInArray&& x) noexcept; + TheOtherObjectInArray&& x) noexcept + { + m_some_num = x.m_some_num; + m_positive = x.m_positive; + } /*! * @brief Copy assignment. * @param x Reference to the object TheOtherObjectInArray that will be copied. */ eProsima_user_DllExport TheOtherObjectInArray& operator =( - const TheOtherObjectInArray& x); + const TheOtherObjectInArray& x) + { + + m_some_num = x.m_some_num; + + m_positive = x.m_positive; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object TheOtherObjectInArray that will be copied. */ eProsima_user_DllExport TheOtherObjectInArray& operator =( - TheOtherObjectInArray&& x) noexcept; + TheOtherObjectInArray&& x) noexcept + { + + m_some_num = x.m_some_num; + m_positive = x.m_positive; + return *this; + } /*! * @brief Comparison operator. * @param x TheOtherObjectInArray object to compare. */ eProsima_user_DllExport bool operator ==( - const TheOtherObjectInArray& x) const; + const TheOtherObjectInArray& x) const + { + return (m_some_num == x.m_some_num && + m_positive == x.m_positive); + } /*! * @brief Comparison operator. * @param x TheOtherObjectInArray object to compare. */ eProsima_user_DllExport bool operator !=( - const TheOtherObjectInArray& x) const; + const TheOtherObjectInArray& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member some_num * @param _some_num New value for member some_num */ eProsima_user_DllExport void some_num( - int32_t _some_num); + int32_t _some_num) + { + m_some_num = _some_num; + } /*! * @brief This function returns the value of member some_num * @return Value of member some_num */ - eProsima_user_DllExport int32_t some_num() const; + eProsima_user_DllExport int32_t some_num() const + { + return m_some_num; + } /*! * @brief This function returns a reference to member some_num * @return Reference to member some_num */ - eProsima_user_DllExport int32_t& some_num(); + eProsima_user_DllExport int32_t& some_num() + { + return m_some_num; + } /*! @@ -160,19 +179,30 @@ class TheOtherObjectInArray * @param _positive New value for member positive */ eProsima_user_DllExport void positive( - bool _positive); + bool _positive) + { + m_positive = _positive; + } /*! * @brief This function returns the value of member positive * @return Value of member positive */ - eProsima_user_DllExport bool positive() const; + eProsima_user_DllExport bool positive() const + { + return m_positive; + } /*! * @brief This function returns a reference to member positive * @return Reference to member positive */ - eProsima_user_DllExport bool& positive(); + eProsima_user_DllExport bool& positive() + { + return m_positive; + } + + private: @@ -180,8 +210,6 @@ class TheOtherObjectInArray bool m_positive{false}; }; - - /*! * @brief This class represents the structure basic_array_struct defined by the user in the IDL file. * @ingroup basic_array_struct @@ -193,73 +221,117 @@ class basic_array_struct /*! * @brief Default constructor. */ - eProsima_user_DllExport basic_array_struct(); + eProsima_user_DllExport basic_array_struct() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~basic_array_struct(); + eProsima_user_DllExport ~basic_array_struct() + { + } /*! * @brief Copy constructor. * @param x Reference to the object basic_array_struct that will be copied. */ eProsima_user_DllExport basic_array_struct( - const basic_array_struct& x); + const basic_array_struct& x) + { + m_index = x.m_index; + + m_sub_structs = x.m_sub_structs; + + } /*! * @brief Move constructor. * @param x Reference to the object basic_array_struct that will be copied. */ eProsima_user_DllExport basic_array_struct( - basic_array_struct&& x) noexcept; + basic_array_struct&& x) noexcept + { + m_index = x.m_index; + m_sub_structs = std::move(x.m_sub_structs); + } /*! * @brief Copy assignment. * @param x Reference to the object basic_array_struct that will be copied. */ eProsima_user_DllExport basic_array_struct& operator =( - const basic_array_struct& x); + const basic_array_struct& x) + { + + m_index = x.m_index; + + m_sub_structs = x.m_sub_structs; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object basic_array_struct that will be copied. */ eProsima_user_DllExport basic_array_struct& operator =( - basic_array_struct&& x) noexcept; + basic_array_struct&& x) noexcept + { + + m_index = x.m_index; + m_sub_structs = std::move(x.m_sub_structs); + return *this; + } /*! * @brief Comparison operator. * @param x basic_array_struct object to compare. */ eProsima_user_DllExport bool operator ==( - const basic_array_struct& x) const; + const basic_array_struct& x) const + { + return (m_index == x.m_index && + m_sub_structs == x.m_sub_structs); + } /*! * @brief Comparison operator. * @param x basic_array_struct object to compare. */ eProsima_user_DllExport bool operator !=( - const basic_array_struct& x) const; + const basic_array_struct& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member index * @param _index New value for member index */ eProsima_user_DllExport void index( - uint32_t _index); + uint32_t _index) + { + m_index = _index; + } /*! * @brief This function returns the value of member index * @return Value of member index */ - eProsima_user_DllExport uint32_t index() const; + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } /*! * @brief This function returns a reference to member index * @return Reference to member index */ - eProsima_user_DllExport uint32_t& index(); + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } /*! @@ -267,26 +339,40 @@ class basic_array_struct * @param _sub_structs New value to be copied in member sub_structs */ eProsima_user_DllExport void sub_structs( - const std::array& _sub_structs); + const std::array& _sub_structs) + { + m_sub_structs = _sub_structs; + } /*! * @brief This function moves the value in member sub_structs * @param _sub_structs New value to be moved in member sub_structs */ eProsima_user_DllExport void sub_structs( - std::array&& _sub_structs); + std::array&& _sub_structs) + { + m_sub_structs = std::move(_sub_structs); + } /*! * @brief This function returns a constant reference to member sub_structs * @return Constant reference to member sub_structs */ - eProsima_user_DllExport const std::array& sub_structs() const; + eProsima_user_DllExport const std::array& sub_structs() const + { + return m_sub_structs; + } /*! * @brief This function returns a reference to member sub_structs * @return Reference to member sub_structs */ - eProsima_user_DllExport std::array& sub_structs(); + eProsima_user_DllExport std::array& sub_structs() + { + return m_sub_structs; + } + + private: @@ -295,8 +381,6 @@ class basic_array_struct }; -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ - +#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp index 0ef831d5..aa07447f 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_HPP_ #define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_HPP_ -#include "basic_array_struct.h" +#include "basic_array_struct.hpp" constexpr uint32_t basic_array_struct_max_cdr_typesize {69UL}; constexpr uint32_t basic_array_struct_max_key_cdr_typesize {0UL}; @@ -37,14 +37,10 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const TheOtherObjectInArray& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const basic_array_struct& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp index fafd51bf..4d1ab4f1 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -120,8 +118,6 @@ void serialize_key( } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx index dae8639b..c0b9597a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx @@ -19,18 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "basic_array_structPubSubTypes.h" +#include #include -#include "basic_array_structPubSubTypes.h" #include "basic_array_structCdrAux.hpp" +#include "basic_array_structTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - TheOtherObjectInArrayPubSubType::TheOtherObjectInArrayPubSubType() { setName("TheOtherObjectInArray"); @@ -219,7 +219,10 @@ bool TheOtherObjectInArrayPubSubType::getKey( return true; } - +void TheOtherObjectInArrayPubSubType::register_type_object_representation() const +{ + register_basic_array_struct_type_objects(); +} basic_array_structPubSubType::basic_array_structPubSubType() { @@ -409,3 +412,11 @@ bool basic_array_structPubSubType::getKey( return true; } +void basic_array_structPubSubType::register_type_object_representation() const +{ + register_basic_array_struct_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "basic_array_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h index 33c7ade9..f287a3ff 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "basic_array_struct.h" +#include "basic_array_struct.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type TheOtherObjectInArray defined by the user in the IDL file. * @ingroup basic_array_struct @@ -90,6 +88,9 @@ class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -128,8 +129,6 @@ class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicData }; - - /*! * @brief This class represents the TopicDataType of the type basic_array_struct defined by the user in the IDL file. * @ingroup basic_array_struct @@ -180,6 +179,9 @@ class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataTyp eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx new file mode 100644 index 00000000..8f61b361 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx @@ -0,0 +1,622 @@ +// 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 basic_array_structTypeObjectSupport.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. + */ + +#include "basic_array_structTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "basic_array_struct.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_basic_array_struct_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_TheOtherObjectInArray_type_identifier(); + + register_basic_array_struct_type_identifier(); + + }); +} + +void register_TheOtherObjectInArray_type_identifier() +{ + { + StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_TheOtherObjectInArray; + TypeIdentifierPair type_ids_TheOtherObjectInArray; + QualifiedTypeName type_name_TheOtherObjectInArray = "TheOtherObjectInArray"; + eprosima::fastcdr::optional type_ann_builtin_TheOtherObjectInArray; + eprosima::fastcdr::optional ann_custom_TheOtherObjectInArray; + CompleteTypeDetail detail_TheOtherObjectInArray = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObjectInArray, ann_custom_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string()); + CompleteStructHeader header_TheOtherObjectInArray; + header_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObjectInArray); + CompleteStructMemberSeq member_seq_TheOtherObjectInArray; + { + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_TheOtherObjectInArray); + + if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_some_num; + MemberId member_id_some_num = 0x00000000; + if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure some_num member TypeIdentifier inconsistent."); + return; + } + MemberName name_some_num = "some_num"; + eprosima::fastcdr::optional member_ann_builtin_some_num; + ann_custom_TheOtherObjectInArray.reset(); + CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObjectInArray); + CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_some_num); + } + { + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_TheOtherObjectInArray); + + if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_positive; + MemberId member_id_positive = 0x00000001; + if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_TheOtherObjectInArray.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_TheOtherObjectInArray); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_positive); + } + CompleteStructType struct_type_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObjectInArray, header_TheOtherObjectInArray, member_seq_TheOtherObjectInArray); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObjectInArray already registered in TypeObjectRegistry for a different type."); + } + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); + if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObjectInArray: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_basic_array_struct_type_identifier() +{ + { + StructTypeFlag struct_flags_basic_array_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_basic_array_struct; + TypeIdentifierPair type_ids_basic_array_struct; + QualifiedTypeName type_name_basic_array_struct = "basic_array_struct"; + eprosima::fastcdr::optional type_ann_builtin_basic_array_struct; + eprosima::fastcdr::optional ann_custom_basic_array_struct; + CompleteTypeDetail detail_basic_array_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_basic_array_struct, ann_custom_basic_array_struct, type_name_basic_array_struct.to_string()); + CompleteStructHeader header_basic_array_struct; + header_basic_array_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_array_struct); + CompleteStructMemberSeq member_seq_basic_array_struct; + { + return_code_basic_array_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_basic_array_struct); + + if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_index; + MemberId member_id_index = 0x00000000; + if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_array_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_basic_array_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_basic_array_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_basic_array_struct.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_basic_array_struct); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_basic_array_struct, member_index); + } + { + return_code_basic_array_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_TheOtherObjectInArray_5", type_ids_basic_array_struct); + + if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_basic_array_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObjectInArray", type_ids_basic_array_struct); + + if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_TheOtherObjectInArray; + TypeIdentifierPair type_ids_TheOtherObjectInArray; + QualifiedTypeName type_name_TheOtherObjectInArray = "TheOtherObjectInArray"; + eprosima::fastcdr::optional type_ann_builtin_TheOtherObjectInArray; + eprosima::fastcdr::optional ann_custom_TheOtherObjectInArray; + CompleteTypeDetail detail_TheOtherObjectInArray = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObjectInArray, ann_custom_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string()); + CompleteStructHeader header_TheOtherObjectInArray; + header_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObjectInArray); + CompleteStructMemberSeq member_seq_TheOtherObjectInArray; + { + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_TheOtherObjectInArray); + + if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_some_num; + MemberId member_id_some_num = 0x00000000; + if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure some_num member TypeIdentifier inconsistent."); + return; + } + MemberName name_some_num = "some_num"; + eprosima::fastcdr::optional member_ann_builtin_some_num; + ann_custom_TheOtherObjectInArray.reset(); + CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObjectInArray); + CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_some_num); + } + { + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_TheOtherObjectInArray); + + if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_positive; + MemberId member_id_positive = 0x00000001; + if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_TheOtherObjectInArray.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_TheOtherObjectInArray); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_positive); + } + CompleteStructType struct_type_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObjectInArray, header_TheOtherObjectInArray, member_seq_TheOtherObjectInArray); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObjectInArray already registered in TypeObjectRegistry for a different type."); + } + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); + if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObjectInArray: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_array_TheOtherObjectInArray_5 {nullptr}; + if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_array_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_TheOtherObjectInArray_5 = new TypeIdentifier(type_ids_basic_array_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_TheOtherObjectInArray_5 = new TypeIdentifier(type_ids_basic_array_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_COMPLETE; + if (TK_NONE == type_ids_basic_array_struct.type_identifier2()._d()) + { + equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_TheOtherObjectInArray_5 = 0; + PlainCollectionHeader header_anonymous_array_TheOtherObjectInArray_5 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_TheOtherObjectInArray_5, element_flags_anonymous_array_TheOtherObjectInArray_5); + std::string type_id_kind_anonymous_array_TheOtherObjectInArray_5("TI_PLAIN_ARRAY_SMALL"); + if (type_id_kind_anonymous_array_TheOtherObjectInArray_5 == "TI_PLAIN_ARRAY_SMALL") + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(5)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_TheOtherObjectInArray_5, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_TheOtherObjectInArray_5)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_TheOtherObjectInArray_5")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_TheOtherObjectInArray_5 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(5)); + + PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_TheOtherObjectInArray_5, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_TheOtherObjectInArray_5)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_TheOtherObjectInArray_5")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_TheOtherObjectInArray_5 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_basic_array_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_TheOtherObjectInArray_5", type_ids_basic_array_struct); + if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_TheOtherObjectInArray_5: Given Array TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_sub_structs = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_sub_structs; + MemberId member_id_sub_structs = 0x00000001; + if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_array_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_sub_structs = TypeObjectUtils::build_common_struct_member(member_id_sub_structs, member_flags_sub_structs, type_ids_basic_array_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_sub_structs = TypeObjectUtils::build_common_struct_member(member_id_sub_structs, member_flags_sub_structs, type_ids_basic_array_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure sub_structs member TypeIdentifier inconsistent."); + return; + } + MemberName name_sub_structs = "sub_structs"; + eprosima::fastcdr::optional member_ann_builtin_sub_structs; + ann_custom_basic_array_struct.reset(); + CompleteMemberDetail detail_sub_structs = TypeObjectUtils::build_complete_member_detail(name_sub_structs, member_ann_builtin_sub_structs, ann_custom_basic_array_struct); + CompleteStructMember member_sub_structs = TypeObjectUtils::build_complete_struct_member(common_sub_structs, detail_sub_structs); + TypeObjectUtils::add_complete_struct_member(member_seq_basic_array_struct, member_sub_structs); + } + CompleteStructType struct_type_basic_array_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_array_struct, header_basic_array_struct, member_seq_basic_array_struct); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_array_struct, type_name_basic_array_struct.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "basic_array_struct already registered in TypeObjectRegistry for a different type."); + } + return_code_basic_array_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "basic_array_struct", type_ids_basic_array_struct); + if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "basic_array_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp new file mode 100644 index 00000000..6c4257e8 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp @@ -0,0 +1,61 @@ +// 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 basic_array_structTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_basic_array_struct_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register TheOtherObjectInArray related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_TheOtherObjectInArray_type_identifier(); +/** + * @brief Register basic_array_struct related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_basic_array_struct_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp similarity index 69% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_struct.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp index a7ee0514..03642cf3 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_struct.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp @@ -13,32 +13,17 @@ // limitations under the License. /*! - * @file basic_struct.h + * @file basic_struct.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "basic_structv1.h" +#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_HPP_ +#define _FAST_DDS_GENERATED_BASIC_STRUCT_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_H_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_H_ - -#include -#include #include -#include -#include -#include - -#include -#include -#include - - +#include #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +49,6 @@ #define BASIC_STRUCT_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure TheOtherObject defined by the user in the IDL file. * @ingroup basic_struct @@ -86,81 +60,118 @@ class TheOtherObject /*! * @brief Default constructor. */ - eProsima_user_DllExport TheOtherObject(); + eProsima_user_DllExport TheOtherObject() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~TheOtherObject(); + eProsima_user_DllExport ~TheOtherObject() + { + } /*! * @brief Copy constructor. * @param x Reference to the object TheOtherObject that will be copied. */ eProsima_user_DllExport TheOtherObject( - const TheOtherObject& x); + const TheOtherObject& x) + { + m_some_num = x.m_some_num; + + } /*! * @brief Move constructor. * @param x Reference to the object TheOtherObject that will be copied. */ eProsima_user_DllExport TheOtherObject( - TheOtherObject&& x) noexcept; + TheOtherObject&& x) noexcept + { + m_some_num = x.m_some_num; + } /*! * @brief Copy assignment. * @param x Reference to the object TheOtherObject that will be copied. */ eProsima_user_DllExport TheOtherObject& operator =( - const TheOtherObject& x); + const TheOtherObject& x) + { + + m_some_num = x.m_some_num; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object TheOtherObject that will be copied. */ eProsima_user_DllExport TheOtherObject& operator =( - TheOtherObject&& x) noexcept; + TheOtherObject&& x) noexcept + { + + m_some_num = x.m_some_num; + return *this; + } /*! * @brief Comparison operator. * @param x TheOtherObject object to compare. */ eProsima_user_DllExport bool operator ==( - const TheOtherObject& x) const; + const TheOtherObject& x) const + { + return (m_some_num == x.m_some_num); + } /*! * @brief Comparison operator. * @param x TheOtherObject object to compare. */ eProsima_user_DllExport bool operator !=( - const TheOtherObject& x) const; + const TheOtherObject& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member some_num * @param _some_num New value for member some_num */ eProsima_user_DllExport void some_num( - int32_t _some_num); + int32_t _some_num) + { + m_some_num = _some_num; + } /*! * @brief This function returns the value of member some_num * @return Value of member some_num */ - eProsima_user_DllExport int32_t some_num() const; + eProsima_user_DllExport int32_t some_num() const + { + return m_some_num; + } /*! * @brief This function returns a reference to member some_num * @return Reference to member some_num */ - eProsima_user_DllExport int32_t& some_num(); + eProsima_user_DllExport int32_t& some_num() + { + return m_some_num; + } + + private: int32_t m_some_num{0}; }; - - /*! * @brief This class represents the structure basic_struct defined by the user in the IDL file. * @ingroup basic_struct @@ -172,80 +183,122 @@ class basic_struct /*! * @brief Default constructor. */ - eProsima_user_DllExport basic_struct(); + eProsima_user_DllExport basic_struct() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~basic_struct(); + eProsima_user_DllExport ~basic_struct() + { + } /*! * @brief Copy constructor. * @param x Reference to the object basic_struct that will be copied. */ eProsima_user_DllExport basic_struct( - const basic_struct& x); + const basic_struct& x) + { + m_sub_struct = x.m_sub_struct; + + } /*! * @brief Move constructor. * @param x Reference to the object basic_struct that will be copied. */ eProsima_user_DllExport basic_struct( - basic_struct&& x) noexcept; + basic_struct&& x) noexcept + { + m_sub_struct = std::move(x.m_sub_struct); + } /*! * @brief Copy assignment. * @param x Reference to the object basic_struct that will be copied. */ eProsima_user_DllExport basic_struct& operator =( - const basic_struct& x); + const basic_struct& x) + { + + m_sub_struct = x.m_sub_struct; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object basic_struct that will be copied. */ eProsima_user_DllExport basic_struct& operator =( - basic_struct&& x) noexcept; + basic_struct&& x) noexcept + { + + m_sub_struct = std::move(x.m_sub_struct); + return *this; + } /*! * @brief Comparison operator. * @param x basic_struct object to compare. */ eProsima_user_DllExport bool operator ==( - const basic_struct& x) const; + const basic_struct& x) const + { + return (m_sub_struct == x.m_sub_struct); + } /*! * @brief Comparison operator. * @param x basic_struct object to compare. */ eProsima_user_DllExport bool operator !=( - const basic_struct& x) const; + const basic_struct& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member sub_struct * @param _sub_struct New value to be copied in member sub_struct */ eProsima_user_DllExport void sub_struct( - const TheOtherObject& _sub_struct); + const TheOtherObject& _sub_struct) + { + m_sub_struct = _sub_struct; + } /*! * @brief This function moves the value in member sub_struct * @param _sub_struct New value to be moved in member sub_struct */ eProsima_user_DllExport void sub_struct( - TheOtherObject&& _sub_struct); + TheOtherObject&& _sub_struct) + { + m_sub_struct = std::move(_sub_struct); + } /*! * @brief This function returns a constant reference to member sub_struct * @return Constant reference to member sub_struct */ - eProsima_user_DllExport const TheOtherObject& sub_struct() const; + eProsima_user_DllExport const TheOtherObject& sub_struct() const + { + return m_sub_struct; + } /*! * @brief This function returns a reference to member sub_struct * @return Reference to member sub_struct */ - eProsima_user_DllExport TheOtherObject& sub_struct(); + eProsima_user_DllExport TheOtherObject& sub_struct() + { + return m_sub_struct; + } + + private: @@ -253,8 +306,6 @@ class basic_struct }; -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_H_ - +#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp similarity index 98% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp index 45b59460..1b9a2ea8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_HPP_ #define _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_HPP_ -#include "basic_struct.h" +#include "basic_struct.hpp" constexpr uint32_t basic_struct_max_cdr_typesize {12UL}; constexpr uint32_t basic_struct_max_key_cdr_typesize {0UL}; @@ -37,14 +37,10 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const TheOtherObject& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const basic_struct& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp index 474987db..d936fdf2 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -112,8 +110,6 @@ void serialize_key( } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx index 8ada3884..72df7521 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx @@ -19,18 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "basic_structPubSubTypes.h" +#include #include -#include "basic_structPubSubTypes.h" #include "basic_structCdrAux.hpp" +#include "basic_structTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - TheOtherObjectPubSubType::TheOtherObjectPubSubType() { setName("TheOtherObject"); @@ -219,7 +219,10 @@ bool TheOtherObjectPubSubType::getKey( return true; } - +void TheOtherObjectPubSubType::register_type_object_representation() const +{ + register_basic_struct_type_objects(); +} basic_structPubSubType::basic_structPubSubType() { @@ -409,3 +412,11 @@ bool basic_structPubSubType::getKey( return true; } +void basic_structPubSubType::register_type_object_representation() const +{ + register_basic_struct_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "basic_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h index 042149ca..97b92306 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "basic_struct.h" +#include "basic_struct.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type TheOtherObject defined by the user in the IDL file. * @ingroup basic_struct @@ -90,6 +88,9 @@ class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -128,8 +129,6 @@ class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType }; - - /*! * @brief This class represents the TopicDataType of the type basic_struct defined by the user in the IDL file. * @ingroup basic_struct @@ -180,6 +179,9 @@ class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx new file mode 100644 index 00000000..ddbf4035 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx @@ -0,0 +1,335 @@ +// 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 basic_structTypeObjectSupport.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. + */ + +#include "basic_structTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "basic_struct.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_basic_struct_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_TheOtherObject_type_identifier(); + + register_basic_struct_type_identifier(); + + }); +} + +void register_TheOtherObject_type_identifier() +{ + { + StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_TheOtherObject; + TypeIdentifierPair type_ids_TheOtherObject; + QualifiedTypeName type_name_TheOtherObject = "TheOtherObject"; + eprosima::fastcdr::optional type_ann_builtin_TheOtherObject; + eprosima::fastcdr::optional ann_custom_TheOtherObject; + CompleteTypeDetail detail_TheOtherObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObject, ann_custom_TheOtherObject, type_name_TheOtherObject.to_string()); + CompleteStructHeader header_TheOtherObject; + header_TheOtherObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObject); + CompleteStructMemberSeq member_seq_TheOtherObject; + { + return_code_TheOtherObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_TheOtherObject); + + if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_some_num; + MemberId member_id_some_num = 0x00000000; + if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure some_num member TypeIdentifier inconsistent."); + return; + } + MemberName name_some_num = "some_num"; + eprosima::fastcdr::optional member_ann_builtin_some_num; + ann_custom_TheOtherObject.reset(); + CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObject); + CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObject, member_some_num); + } + CompleteStructType struct_type_TheOtherObject = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObject, header_TheOtherObject, member_seq_TheOtherObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObject, type_name_TheOtherObject.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObject already registered in TypeObjectRegistry for a different type."); + } + return_code_TheOtherObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObject", type_ids_TheOtherObject); + if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_basic_struct_type_identifier() +{ + { + StructTypeFlag struct_flags_basic_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_basic_struct; + TypeIdentifierPair type_ids_basic_struct; + QualifiedTypeName type_name_basic_struct = "basic_struct"; + eprosima::fastcdr::optional type_ann_builtin_basic_struct; + eprosima::fastcdr::optional ann_custom_basic_struct; + CompleteTypeDetail detail_basic_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_basic_struct, ann_custom_basic_struct, type_name_basic_struct.to_string()); + CompleteStructHeader header_basic_struct; + header_basic_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_struct); + CompleteStructMemberSeq member_seq_basic_struct; + { + return_code_basic_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObject", type_ids_basic_struct); + + if (return_code_basic_struct != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_TheOtherObject; + TypeIdentifierPair type_ids_TheOtherObject; + QualifiedTypeName type_name_TheOtherObject = "TheOtherObject"; + eprosima::fastcdr::optional type_ann_builtin_TheOtherObject; + eprosima::fastcdr::optional ann_custom_TheOtherObject; + CompleteTypeDetail detail_TheOtherObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObject, ann_custom_TheOtherObject, type_name_TheOtherObject.to_string()); + CompleteStructHeader header_TheOtherObject; + header_TheOtherObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObject); + CompleteStructMemberSeq member_seq_TheOtherObject; + { + return_code_TheOtherObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_TheOtherObject); + + if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_some_num; + MemberId member_id_some_num = 0x00000000; + if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && + (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure some_num member TypeIdentifier inconsistent."); + return; + } + MemberName name_some_num = "some_num"; + eprosima::fastcdr::optional member_ann_builtin_some_num; + ann_custom_TheOtherObject.reset(); + CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObject); + CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObject, member_some_num); + } + CompleteStructType struct_type_TheOtherObject = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObject, header_TheOtherObject, member_seq_TheOtherObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObject, type_name_TheOtherObject.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObject already registered in TypeObjectRegistry for a different type."); + } + return_code_TheOtherObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObject", type_ids_TheOtherObject); + if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_sub_struct = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_sub_struct; + MemberId member_id_sub_struct = 0x00000000; + if (EK_COMPLETE == type_ids_basic_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_sub_struct = TypeObjectUtils::build_common_struct_member(member_id_sub_struct, member_flags_sub_struct, type_ids_basic_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_basic_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_basic_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_basic_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_basic_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_basic_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_basic_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_sub_struct = TypeObjectUtils::build_common_struct_member(member_id_sub_struct, member_flags_sub_struct, type_ids_basic_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure sub_struct member TypeIdentifier inconsistent."); + return; + } + MemberName name_sub_struct = "sub_struct"; + eprosima::fastcdr::optional member_ann_builtin_sub_struct; + ann_custom_basic_struct.reset(); + CompleteMemberDetail detail_sub_struct = TypeObjectUtils::build_complete_member_detail(name_sub_struct, member_ann_builtin_sub_struct, ann_custom_basic_struct); + CompleteStructMember member_sub_struct = TypeObjectUtils::build_complete_struct_member(common_sub_struct, detail_sub_struct); + TypeObjectUtils::add_complete_struct_member(member_seq_basic_struct, member_sub_struct); + } + CompleteStructType struct_type_basic_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_struct, header_basic_struct, member_seq_basic_struct); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_struct, type_name_basic_struct.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "basic_struct already registered in TypeObjectRegistry for a different type."); + } + return_code_basic_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "basic_struct", type_ids_basic_struct); + if (return_code_basic_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "basic_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp new file mode 100644 index 00000000..37fd01e9 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp @@ -0,0 +1,61 @@ +// 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 basic_structTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_basic_struct_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register TheOtherObject related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_TheOtherObject_type_identifier(); +/** + * @brief Register basic_struct related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_basic_struct_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequence.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp similarity index 74% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequence.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp index dcd658a9..f1cb9210 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequence.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp @@ -13,32 +13,19 @@ // limitations under the License. /*! - * @file char_sequence.h + * @file char_sequence.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "char_sequencev1.h" +#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_HPP_ +#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ - -#include -#include #include -#include -#include +#include #include -#include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,19 +51,6 @@ #define CHAR_SEQUENCE_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - - - /*! * @brief This class represents the structure char_sequence defined by the user in the IDL file. * @ingroup char_sequence @@ -88,80 +62,122 @@ class char_sequence /*! * @brief Default constructor. */ - eProsima_user_DllExport char_sequence(); + eProsima_user_DllExport char_sequence() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~char_sequence(); + eProsima_user_DllExport ~char_sequence() + { + } /*! * @brief Copy constructor. * @param x Reference to the object char_sequence that will be copied. */ eProsima_user_DllExport char_sequence( - const char_sequence& x); + const char_sequence& x) + { + m_chars = x.m_chars; + + } /*! * @brief Move constructor. * @param x Reference to the object char_sequence that will be copied. */ eProsima_user_DllExport char_sequence( - char_sequence&& x) noexcept; + char_sequence&& x) noexcept + { + m_chars = std::move(x.m_chars); + } /*! * @brief Copy assignment. * @param x Reference to the object char_sequence that will be copied. */ eProsima_user_DllExport char_sequence& operator =( - const char_sequence& x); + const char_sequence& x) + { + + m_chars = x.m_chars; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object char_sequence that will be copied. */ eProsima_user_DllExport char_sequence& operator =( - char_sequence&& x) noexcept; + char_sequence&& x) noexcept + { + + m_chars = std::move(x.m_chars); + return *this; + } /*! * @brief Comparison operator. * @param x char_sequence object to compare. */ eProsima_user_DllExport bool operator ==( - const char_sequence& x) const; + const char_sequence& x) const + { + return (m_chars == x.m_chars); + } /*! * @brief Comparison operator. * @param x char_sequence object to compare. */ eProsima_user_DllExport bool operator !=( - const char_sequence& x) const; + const char_sequence& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member chars * @param _chars New value to be copied in member chars */ eProsima_user_DllExport void chars( - const std::vector& _chars); + const std::vector& _chars) + { + m_chars = _chars; + } /*! * @brief This function moves the value in member chars * @param _chars New value to be moved in member chars */ eProsima_user_DllExport void chars( - std::vector&& _chars); + std::vector&& _chars) + { + m_chars = std::move(_chars); + } /*! * @brief This function returns a constant reference to member chars * @return Constant reference to member chars */ - eProsima_user_DllExport const std::vector& chars() const; + eProsima_user_DllExport const std::vector& chars() const + { + return m_chars; + } /*! * @brief This function returns a reference to member chars * @return Reference to member chars */ - eProsima_user_DllExport std::vector& chars(); + eProsima_user_DllExport std::vector& chars() + { + return m_chars; + } + + private: @@ -169,8 +185,6 @@ class char_sequence }; -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ - +#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp index 405e325c..11d7c4bd 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_HPP_ #define _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_HPP_ -#include "char_sequence.h" +#include "char_sequence.hpp" constexpr uint32_t char_sequence_max_cdr_typesize {8UL}; constexpr uint32_t char_sequence_max_key_cdr_typesize {0UL}; @@ -34,10 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const char_sequence& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp index 8939ae4b..756dc0bd 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp @@ -34,10 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencePubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx index 3dd6bcf6..cdf53a3b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx @@ -19,20 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "char_sequencePubSubTypes.h" +#include #include -#include "char_sequencePubSubTypes.h" #include "char_sequenceCdrAux.hpp" +#include "char_sequenceTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - - char_sequencePubSubType::char_sequencePubSubType() { setName("char_sequence"); @@ -221,3 +219,11 @@ bool char_sequencePubSubType::getKey( return true; } +void char_sequencePubSubType::register_type_object_representation() const +{ + register_char_sequence_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "char_sequenceCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencePubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h index 53dfa6eb..0567daff 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "char_sequence.h" +#include "char_sequence.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,10 +38,6 @@ #endif // GEN_API_VER - - - - /*! * @brief This class represents the TopicDataType of the type char_sequence defined by the user in the IDL file. * @ingroup char_sequence @@ -92,6 +88,9 @@ class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx new file mode 100644 index 00000000..98322a9f --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx @@ -0,0 +1,238 @@ +// 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 char_sequenceTypeObjectSupport.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. + */ + +#include "char_sequenceTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "char_sequence.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_char_sequence_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_char_sequence_type_identifier(); + + }); +} + +void register_char_sequence_type_identifier() +{ + { + StructTypeFlag struct_flags_char_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_char_sequence; + TypeIdentifierPair type_ids_char_sequence; + QualifiedTypeName type_name_char_sequence = "char_sequence"; + eprosima::fastcdr::optional type_ann_builtin_char_sequence; + eprosima::fastcdr::optional ann_custom_char_sequence; + CompleteTypeDetail detail_char_sequence = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_char_sequence, ann_custom_char_sequence, type_name_char_sequence.to_string()); + CompleteStructHeader header_char_sequence; + header_char_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_char_sequence); + CompleteStructMemberSeq member_seq_char_sequence; + { + return_code_char_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_char_unbounded", type_ids_char_sequence); + + if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_char_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_char", type_ids_char_sequence); + + if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + TypeIdentifier* element_identifier_anonymous_sequence_char_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_char_sequence.type_identifier1()._d() || TK_NONE == type_ids_char_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_char_unbounded = new TypeIdentifier(type_ids_char_sequence.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_char_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_char_unbounded = new TypeIdentifier(type_ids_char_sequence.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_char_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_char_sequence.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_char_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_char_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_char_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_char_unbounded, element_flags_anonymous_sequence_char_unbounded); + std::string type_id_kind_anonymous_sequence_char_unbounded("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_char_unbounded == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_char_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_char_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_char_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_char_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_char_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_char_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_char_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_char_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_char_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_char_unbounded", type_ids_char_sequence); + if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_char_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_chars = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_chars; + MemberId member_id_chars = 0x00000000; + if (EK_COMPLETE == type_ids_char_sequence.type_identifier1()._d() || TK_NONE == type_ids_char_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_chars = TypeObjectUtils::build_common_struct_member(member_id_chars, member_flags_chars, type_ids_char_sequence.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_char_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_chars = TypeObjectUtils::build_common_struct_member(member_id_chars, member_flags_chars, type_ids_char_sequence.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure chars member TypeIdentifier inconsistent."); + return; + } + MemberName name_chars = "chars"; + eprosima::fastcdr::optional member_ann_builtin_chars; + ann_custom_char_sequence.reset(); + CompleteMemberDetail detail_chars = TypeObjectUtils::build_complete_member_detail(name_chars, member_ann_builtin_chars, ann_custom_char_sequence); + CompleteStructMember member_chars = TypeObjectUtils::build_complete_struct_member(common_chars, detail_chars); + TypeObjectUtils::add_complete_struct_member(member_seq_char_sequence, member_chars); + } + CompleteStructType struct_type_char_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_char_sequence, header_char_sequence, member_seq_char_sequence); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_char_sequence, type_name_char_sequence.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "char_sequence already registered in TypeObjectRegistry for a different type."); + } + return_code_char_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "char_sequence", type_ids_char_sequence); + if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "char_sequence: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp new file mode 100644 index 00000000..e3a2274f --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp @@ -0,0 +1,54 @@ +// 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 char_sequenceTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_char_sequence_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register char_sequence related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_char_sequence_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arrays.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp similarity index 66% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arrays.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp index 43ed4961..044a0055 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arrays.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp @@ -13,32 +13,22 @@ // limitations under the License. /*! - * @file complex_nested_arrays.h + * @file complex_nested_arrays.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "complex_nested_arraysv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ +#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_HPP_ +#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_HPP_ #include -#include #include -#include #include +#include #include #include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +54,6 @@ #define COMPLEX_NESTED_ARRAYS_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure ThirdLevelElement defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -86,73 +65,117 @@ class ThirdLevelElement /*! * @brief Default constructor. */ - eProsima_user_DllExport ThirdLevelElement(); + eProsima_user_DllExport ThirdLevelElement() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~ThirdLevelElement(); + eProsima_user_DllExport ~ThirdLevelElement() + { + } /*! * @brief Copy constructor. * @param x Reference to the object ThirdLevelElement that will be copied. */ eProsima_user_DllExport ThirdLevelElement( - const ThirdLevelElement& x); + const ThirdLevelElement& x) + { + m_x = x.m_x; + + m_y = x.m_y; + + } /*! * @brief Move constructor. * @param x Reference to the object ThirdLevelElement that will be copied. */ eProsima_user_DllExport ThirdLevelElement( - ThirdLevelElement&& x) noexcept; + ThirdLevelElement&& x) noexcept + { + m_x = x.m_x; + m_y = x.m_y; + } /*! * @brief Copy assignment. * @param x Reference to the object ThirdLevelElement that will be copied. */ eProsima_user_DllExport ThirdLevelElement& operator =( - const ThirdLevelElement& x); + const ThirdLevelElement& x) + { + + m_x = x.m_x; + + m_y = x.m_y; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object ThirdLevelElement that will be copied. */ eProsima_user_DllExport ThirdLevelElement& operator =( - ThirdLevelElement&& x) noexcept; + ThirdLevelElement&& x) noexcept + { + + m_x = x.m_x; + m_y = x.m_y; + return *this; + } /*! * @brief Comparison operator. * @param x ThirdLevelElement object to compare. */ eProsima_user_DllExport bool operator ==( - const ThirdLevelElement& x) const; + const ThirdLevelElement& x) const + { + return (m_x == x.m_x && + m_y == x.m_y); + } /*! * @brief Comparison operator. * @param x ThirdLevelElement object to compare. */ eProsima_user_DllExport bool operator !=( - const ThirdLevelElement& x) const; + const ThirdLevelElement& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member x * @param _x New value for member x */ eProsima_user_DllExport void x( - double _x); + double _x) + { + m_x = _x; + } /*! * @brief This function returns the value of member x * @return Value of member x */ - eProsima_user_DllExport double x() const; + eProsima_user_DllExport double x() const + { + return m_x; + } /*! * @brief This function returns a reference to member x * @return Reference to member x */ - eProsima_user_DllExport double& x(); + eProsima_user_DllExport double& x() + { + return m_x; + } /*! @@ -160,19 +183,30 @@ class ThirdLevelElement * @param _y New value for member y */ eProsima_user_DllExport void y( - double _y); + double _y) + { + m_y = _y; + } /*! * @brief This function returns the value of member y * @return Value of member y */ - eProsima_user_DllExport double y() const; + eProsima_user_DllExport double y() const + { + return m_y; + } /*! * @brief This function returns a reference to member y * @return Reference to member y */ - eProsima_user_DllExport double& y(); + eProsima_user_DllExport double& y() + { + return m_y; + } + + private: @@ -180,10 +214,6 @@ class ThirdLevelElement double m_y{0.0}; }; - - - - /*! * @brief This class represents the structure SecondLevelElement defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -195,80 +225,127 @@ class SecondLevelElement /*! * @brief Default constructor. */ - eProsima_user_DllExport SecondLevelElement(); + eProsima_user_DllExport SecondLevelElement() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~SecondLevelElement(); + eProsima_user_DllExport ~SecondLevelElement() + { + } /*! * @brief Copy constructor. * @param x Reference to the object SecondLevelElement that will be copied. */ eProsima_user_DllExport SecondLevelElement( - const SecondLevelElement& x); + const SecondLevelElement& x) + { + m_an_element_alone = x.m_an_element_alone; + + m_a_limited_other_value = x.m_a_limited_other_value; + + } /*! * @brief Move constructor. * @param x Reference to the object SecondLevelElement that will be copied. */ eProsima_user_DllExport SecondLevelElement( - SecondLevelElement&& x) noexcept; + SecondLevelElement&& x) noexcept + { + m_an_element_alone = std::move(x.m_an_element_alone); + m_a_limited_other_value = std::move(x.m_a_limited_other_value); + } /*! * @brief Copy assignment. * @param x Reference to the object SecondLevelElement that will be copied. */ eProsima_user_DllExport SecondLevelElement& operator =( - const SecondLevelElement& x); + const SecondLevelElement& x) + { + + m_an_element_alone = x.m_an_element_alone; + + m_a_limited_other_value = x.m_a_limited_other_value; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object SecondLevelElement that will be copied. */ eProsima_user_DllExport SecondLevelElement& operator =( - SecondLevelElement&& x) noexcept; + SecondLevelElement&& x) noexcept + { + + m_an_element_alone = std::move(x.m_an_element_alone); + m_a_limited_other_value = std::move(x.m_a_limited_other_value); + return *this; + } /*! * @brief Comparison operator. * @param x SecondLevelElement object to compare. */ eProsima_user_DllExport bool operator ==( - const SecondLevelElement& x) const; + const SecondLevelElement& x) const + { + return (m_an_element_alone == x.m_an_element_alone && + m_a_limited_other_value == x.m_a_limited_other_value); + } /*! * @brief Comparison operator. * @param x SecondLevelElement object to compare. */ eProsima_user_DllExport bool operator !=( - const SecondLevelElement& x) const; + const SecondLevelElement& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member an_element_alone * @param _an_element_alone New value to be copied in member an_element_alone */ eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone); + const ThirdLevelElement& _an_element_alone) + { + m_an_element_alone = _an_element_alone; + } /*! * @brief This function moves the value in member an_element_alone * @param _an_element_alone New value to be moved in member an_element_alone */ eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone); + ThirdLevelElement&& _an_element_alone) + { + m_an_element_alone = std::move(_an_element_alone); + } /*! * @brief This function returns a constant reference to member an_element_alone * @return Constant reference to member an_element_alone */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const; + eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const + { + return m_an_element_alone; + } /*! * @brief This function returns a reference to member an_element_alone * @return Reference to member an_element_alone */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone(); + eProsima_user_DllExport ThirdLevelElement& an_element_alone() + { + return m_an_element_alone; + } /*! @@ -276,26 +353,40 @@ class SecondLevelElement * @param _a_limited_other_value New value to be copied in member a_limited_other_value */ eProsima_user_DllExport void a_limited_other_value( - const std::vector& _a_limited_other_value); + const std::vector& _a_limited_other_value) + { + m_a_limited_other_value = _a_limited_other_value; + } /*! * @brief This function moves the value in member a_limited_other_value * @param _a_limited_other_value New value to be moved in member a_limited_other_value */ eProsima_user_DllExport void a_limited_other_value( - std::vector&& _a_limited_other_value); + std::vector&& _a_limited_other_value) + { + m_a_limited_other_value = std::move(_a_limited_other_value); + } /*! * @brief This function returns a constant reference to member a_limited_other_value * @return Constant reference to member a_limited_other_value */ - eProsima_user_DllExport const std::vector& a_limited_other_value() const; + eProsima_user_DllExport const std::vector& a_limited_other_value() const + { + return m_a_limited_other_value; + } /*! * @brief This function returns a reference to member a_limited_other_value * @return Reference to member a_limited_other_value */ - eProsima_user_DllExport std::vector& a_limited_other_value(); + eProsima_user_DllExport std::vector& a_limited_other_value() + { + return m_a_limited_other_value; + } + + private: @@ -303,8 +394,6 @@ class SecondLevelElement std::vector m_a_limited_other_value; }; - - /*! * @brief This class represents the structure FirstLevelElement defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -316,80 +405,134 @@ class FirstLevelElement /*! * @brief Default constructor. */ - eProsima_user_DllExport FirstLevelElement(); + eProsima_user_DllExport FirstLevelElement() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~FirstLevelElement(); + eProsima_user_DllExport ~FirstLevelElement() + { + } /*! * @brief Copy constructor. * @param x Reference to the object FirstLevelElement that will be copied. */ eProsima_user_DllExport FirstLevelElement( - const FirstLevelElement& x); + const FirstLevelElement& x) + { + m_useless_name = x.m_useless_name; + + m_sub = x.m_sub; + + m_an_element_alone = x.m_an_element_alone; + + } /*! * @brief Move constructor. * @param x Reference to the object FirstLevelElement that will be copied. */ eProsima_user_DllExport FirstLevelElement( - FirstLevelElement&& x) noexcept; + FirstLevelElement&& x) noexcept + { + m_useless_name = std::move(x.m_useless_name); + m_sub = std::move(x.m_sub); + m_an_element_alone = std::move(x.m_an_element_alone); + } /*! * @brief Copy assignment. * @param x Reference to the object FirstLevelElement that will be copied. */ eProsima_user_DllExport FirstLevelElement& operator =( - const FirstLevelElement& x); + const FirstLevelElement& x) + { + + m_useless_name = x.m_useless_name; + + m_sub = x.m_sub; + + m_an_element_alone = x.m_an_element_alone; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object FirstLevelElement that will be copied. */ eProsima_user_DllExport FirstLevelElement& operator =( - FirstLevelElement&& x) noexcept; + FirstLevelElement&& x) noexcept + { + + m_useless_name = std::move(x.m_useless_name); + m_sub = std::move(x.m_sub); + m_an_element_alone = std::move(x.m_an_element_alone); + return *this; + } /*! * @brief Comparison operator. * @param x FirstLevelElement object to compare. */ eProsima_user_DllExport bool operator ==( - const FirstLevelElement& x) const; + const FirstLevelElement& x) const + { + return (m_useless_name == x.m_useless_name && + m_sub == x.m_sub && + m_an_element_alone == x.m_an_element_alone); + } /*! * @brief Comparison operator. * @param x FirstLevelElement object to compare. */ eProsima_user_DllExport bool operator !=( - const FirstLevelElement& x) const; + const FirstLevelElement& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member useless_name * @param _useless_name New value to be copied in member useless_name */ eProsima_user_DllExport void useless_name( - const std::string& _useless_name); + const std::string& _useless_name) + { + m_useless_name = _useless_name; + } /*! * @brief This function moves the value in member useless_name * @param _useless_name New value to be moved in member useless_name */ eProsima_user_DllExport void useless_name( - std::string&& _useless_name); + std::string&& _useless_name) + { + m_useless_name = std::move(_useless_name); + } /*! * @brief This function returns a constant reference to member useless_name * @return Constant reference to member useless_name */ - eProsima_user_DllExport const std::string& useless_name() const; + eProsima_user_DllExport const std::string& useless_name() const + { + return m_useless_name; + } /*! * @brief This function returns a reference to member useless_name * @return Reference to member useless_name */ - eProsima_user_DllExport std::string& useless_name(); + eProsima_user_DllExport std::string& useless_name() + { + return m_useless_name; + } /*! @@ -397,26 +540,38 @@ class FirstLevelElement * @param _sub New value to be copied in member sub */ eProsima_user_DllExport void sub( - const std::vector& _sub); + const std::vector& _sub) + { + m_sub = _sub; + } /*! * @brief This function moves the value in member sub * @param _sub New value to be moved in member sub */ eProsima_user_DllExport void sub( - std::vector&& _sub); + std::vector&& _sub) + { + m_sub = std::move(_sub); + } /*! * @brief This function returns a constant reference to member sub * @return Constant reference to member sub */ - eProsima_user_DllExport const std::vector& sub() const; + eProsima_user_DllExport const std::vector& sub() const + { + return m_sub; + } /*! * @brief This function returns a reference to member sub * @return Reference to member sub */ - eProsima_user_DllExport std::vector& sub(); + eProsima_user_DllExport std::vector& sub() + { + return m_sub; + } /*! @@ -424,26 +579,40 @@ class FirstLevelElement * @param _an_element_alone New value to be copied in member an_element_alone */ eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone); + const ThirdLevelElement& _an_element_alone) + { + m_an_element_alone = _an_element_alone; + } /*! * @brief This function moves the value in member an_element_alone * @param _an_element_alone New value to be moved in member an_element_alone */ eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone); + ThirdLevelElement&& _an_element_alone) + { + m_an_element_alone = std::move(_an_element_alone); + } /*! * @brief This function returns a constant reference to member an_element_alone * @return Constant reference to member an_element_alone */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const; + eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const + { + return m_an_element_alone; + } /*! * @brief This function returns a reference to member an_element_alone * @return Reference to member an_element_alone */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone(); + eProsima_user_DllExport ThirdLevelElement& an_element_alone() + { + return m_an_element_alone; + } + + private: @@ -452,8 +621,6 @@ class FirstLevelElement ThirdLevelElement m_an_element_alone; }; - - /*! * @brief This class represents the structure complex_nested_arrays defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -465,80 +632,122 @@ class complex_nested_arrays /*! * @brief Default constructor. */ - eProsima_user_DllExport complex_nested_arrays(); + eProsima_user_DllExport complex_nested_arrays() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~complex_nested_arrays(); + eProsima_user_DllExport ~complex_nested_arrays() + { + } /*! * @brief Copy constructor. * @param x Reference to the object complex_nested_arrays that will be copied. */ eProsima_user_DllExport complex_nested_arrays( - const complex_nested_arrays& x); + const complex_nested_arrays& x) + { + m_array_of_elements = x.m_array_of_elements; + + } /*! * @brief Move constructor. * @param x Reference to the object complex_nested_arrays that will be copied. */ eProsima_user_DllExport complex_nested_arrays( - complex_nested_arrays&& x) noexcept; + complex_nested_arrays&& x) noexcept + { + m_array_of_elements = std::move(x.m_array_of_elements); + } /*! * @brief Copy assignment. * @param x Reference to the object complex_nested_arrays that will be copied. */ eProsima_user_DllExport complex_nested_arrays& operator =( - const complex_nested_arrays& x); + const complex_nested_arrays& x) + { + + m_array_of_elements = x.m_array_of_elements; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object complex_nested_arrays that will be copied. */ eProsima_user_DllExport complex_nested_arrays& operator =( - complex_nested_arrays&& x) noexcept; + complex_nested_arrays&& x) noexcept + { + + m_array_of_elements = std::move(x.m_array_of_elements); + return *this; + } /*! * @brief Comparison operator. * @param x complex_nested_arrays object to compare. */ eProsima_user_DllExport bool operator ==( - const complex_nested_arrays& x) const; + const complex_nested_arrays& x) const + { + return (m_array_of_elements == x.m_array_of_elements); + } /*! * @brief Comparison operator. * @param x complex_nested_arrays object to compare. */ eProsima_user_DllExport bool operator !=( - const complex_nested_arrays& x) const; + const complex_nested_arrays& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member array_of_elements * @param _array_of_elements New value to be copied in member array_of_elements */ eProsima_user_DllExport void array_of_elements( - const std::array& _array_of_elements); + const std::array& _array_of_elements) + { + m_array_of_elements = _array_of_elements; + } /*! * @brief This function moves the value in member array_of_elements * @param _array_of_elements New value to be moved in member array_of_elements */ eProsima_user_DllExport void array_of_elements( - std::array&& _array_of_elements); + std::array&& _array_of_elements) + { + m_array_of_elements = std::move(_array_of_elements); + } /*! * @brief This function returns a constant reference to member array_of_elements * @return Constant reference to member array_of_elements */ - eProsima_user_DllExport const std::array& array_of_elements() const; + eProsima_user_DllExport const std::array& array_of_elements() const + { + return m_array_of_elements; + } /*! * @brief This function returns a reference to member array_of_elements * @return Reference to member array_of_elements */ - eProsima_user_DllExport std::array& array_of_elements(); + eProsima_user_DllExport std::array& array_of_elements() + { + return m_array_of_elements; + } + + private: @@ -546,8 +755,6 @@ class complex_nested_arrays }; -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ - +#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp index c8b7f3c1..ee7758a8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_HPP_ #define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_HPP_ -#include "complex_nested_arrays.h" +#include "complex_nested_arrays.hpp" constexpr uint32_t FirstLevelElement_max_cdr_typesize {296UL}; constexpr uint32_t FirstLevelElement_max_key_cdr_typesize {0UL}; @@ -43,28 +43,18 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const ThirdLevelElement& data); - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const SecondLevelElement& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const FirstLevelElement& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const complex_nested_arrays& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp index 89a965ad..43e2c0e8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -120,10 +118,6 @@ void serialize_key( } - - - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -208,8 +202,6 @@ void serialize_key( } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -302,8 +294,6 @@ void serialize_key( } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx index 9b559a33..5d34d150 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx @@ -19,18 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "complex_nested_arraysPubSubTypes.h" +#include #include -#include "complex_nested_arraysPubSubTypes.h" #include "complex_nested_arraysCdrAux.hpp" +#include "complex_nested_arraysTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - ThirdLevelElementPubSubType::ThirdLevelElementPubSubType() { setName("ThirdLevelElement"); @@ -219,9 +219,10 @@ bool ThirdLevelElementPubSubType::getKey( return true; } - - - +void ThirdLevelElementPubSubType::register_type_object_representation() const +{ + register_complex_nested_arrays_type_objects(); +} SecondLevelElementPubSubType::SecondLevelElementPubSubType() { @@ -411,7 +412,10 @@ bool SecondLevelElementPubSubType::getKey( return true; } - +void SecondLevelElementPubSubType::register_type_object_representation() const +{ + register_complex_nested_arrays_type_objects(); +} FirstLevelElementPubSubType::FirstLevelElementPubSubType() { @@ -601,7 +605,10 @@ bool FirstLevelElementPubSubType::getKey( return true; } - +void FirstLevelElementPubSubType::register_type_object_representation() const +{ + register_complex_nested_arrays_type_objects(); +} complex_nested_arraysPubSubType::complex_nested_arraysPubSubType() { @@ -791,3 +798,11 @@ bool complex_nested_arraysPubSubType::getKey( return true; } +void complex_nested_arraysPubSubType::register_type_object_representation() const +{ + register_complex_nested_arrays_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "complex_nested_arraysCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h index ccf44d80..98c032f8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "complex_nested_arrays.h" +#include "complex_nested_arrays.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type ThirdLevelElement defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -90,6 +88,9 @@ class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -128,10 +129,6 @@ class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType }; - - - - /*! * @brief This class represents the TopicDataType of the type SecondLevelElement defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -182,6 +179,9 @@ class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataTyp eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -220,8 +220,6 @@ class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataTyp }; - - /*! * @brief This class represents the TopicDataType of the type FirstLevelElement defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -272,6 +270,9 @@ class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -310,8 +311,6 @@ class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType }; - - /*! * @brief This class represents the TopicDataType of the type complex_nested_arrays defined by the user in the IDL file. * @ingroup complex_nested_arrays @@ -362,6 +361,9 @@ class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx new file mode 100644 index 00000000..2791acb9 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx @@ -0,0 +1,3079 @@ +// 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 complex_nested_arraysTypeObjectSupport.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. + */ + +#include "complex_nested_arraysTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "complex_nested_arrays.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_complex_nested_arrays_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_ThirdLevelElement_type_identifier(); + + register_SecondLevelElement_type_identifier(); + + register_FirstLevelElement_type_identifier(); + + register_complex_nested_arrays_type_identifier(); + + }); +} + +void register_ThirdLevelElement_type_identifier() +{ + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_SecondLevelElement_type_identifier() +{ + { + StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_SecondLevelElement; + TypeIdentifierPair type_ids_SecondLevelElement; + QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; + eprosima::fastcdr::optional ann_custom_SecondLevelElement; + CompleteTypeDetail detail_SecondLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SecondLevelElement, ann_custom_SecondLevelElement, type_name_SecondLevelElement.to_string()); + CompleteStructHeader header_SecondLevelElement; + header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); + CompleteStructMemberSeq member_seq_SecondLevelElement; + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_an_element_alone; + MemberId member_id_an_element_alone = 0x00000000; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure an_element_alone member TypeIdentifier inconsistent."); + return; + } + MemberName name_an_element_alone = "an_element_alone"; + eprosima::fastcdr::optional member_ann_builtin_an_element_alone; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_SecondLevelElement); + CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); + } + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {nullptr}; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; + if (TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; + PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); + std::string type_id_kind_anonymous_sequence_ThirdLevelElement_1("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_ThirdLevelElement_1 == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = static_cast(1); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 1; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_ThirdLevelElement_1")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_a_limited_other_value; + MemberId member_id_a_limited_other_value = 0x00000001; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure a_limited_other_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_a_limited_other_value = "a_limited_other_value"; + eprosima::fastcdr::optional member_ann_builtin_a_limited_other_value; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_a_limited_other_value = TypeObjectUtils::build_complete_member_detail(name_a_limited_other_value, member_ann_builtin_a_limited_other_value, ann_custom_SecondLevelElement); + CompleteStructMember member_a_limited_other_value = TypeObjectUtils::build_complete_struct_member(common_a_limited_other_value, detail_a_limited_other_value); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_a_limited_other_value); + } + CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "SecondLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_SecondLevelElement); + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "SecondLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_FirstLevelElement_type_identifier() +{ + { + StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_FirstLevelElement; + TypeIdentifierPair type_ids_FirstLevelElement; + QualifiedTypeName type_name_FirstLevelElement = "FirstLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_FirstLevelElement; + eprosima::fastcdr::optional ann_custom_FirstLevelElement; + CompleteTypeDetail detail_FirstLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_FirstLevelElement, ann_custom_FirstLevelElement, type_name_FirstLevelElement.to_string()); + CompleteStructHeader header_FirstLevelElement; + header_FirstLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_FirstLevelElement); + CompleteStructMemberSeq member_seq_FirstLevelElement; + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_FirstLevelElement); + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_useless_name; + MemberId member_id_useless_name = 0x00000000; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure useless_name member TypeIdentifier inconsistent."); + return; + } + MemberName name_useless_name = "useless_name"; + eprosima::fastcdr::optional member_ann_builtin_useless_name; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_useless_name = TypeObjectUtils::build_complete_member_detail(name_useless_name, member_ann_builtin_useless_name, ann_custom_FirstLevelElement); + CompleteStructMember member_useless_name = TypeObjectUtils::build_complete_struct_member(common_useless_name, detail_useless_name); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_useless_name); + } + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_SecondLevelElement; + TypeIdentifierPair type_ids_SecondLevelElement; + QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; + eprosima::fastcdr::optional ann_custom_SecondLevelElement; + CompleteTypeDetail detail_SecondLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SecondLevelElement, ann_custom_SecondLevelElement, type_name_SecondLevelElement.to_string()); + CompleteStructHeader header_SecondLevelElement; + header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); + CompleteStructMemberSeq member_seq_SecondLevelElement; + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_an_element_alone; + MemberId member_id_an_element_alone = 0x00000000; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure an_element_alone member TypeIdentifier inconsistent."); + return; + } + MemberName name_an_element_alone = "an_element_alone"; + eprosima::fastcdr::optional member_ann_builtin_an_element_alone; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_SecondLevelElement); + CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); + } + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {nullptr}; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; + if (TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; + PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); + std::string type_id_kind_anonymous_sequence_ThirdLevelElement_1("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_ThirdLevelElement_1 == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = static_cast(1); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 1; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_ThirdLevelElement_1")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_a_limited_other_value; + MemberId member_id_a_limited_other_value = 0x00000001; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure a_limited_other_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_a_limited_other_value = "a_limited_other_value"; + eprosima::fastcdr::optional member_ann_builtin_a_limited_other_value; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_a_limited_other_value = TypeObjectUtils::build_complete_member_detail(name_a_limited_other_value, member_ann_builtin_a_limited_other_value, ann_custom_SecondLevelElement); + CompleteStructMember member_a_limited_other_value = TypeObjectUtils::build_complete_struct_member(common_a_limited_other_value, detail_a_limited_other_value); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_a_limited_other_value); + } + CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "SecondLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_SecondLevelElement); + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "SecondLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_SecondLevelElement_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_SecondLevelElement_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_SecondLevelElement_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_SecondLevelElement_unbounded, element_flags_anonymous_sequence_SecondLevelElement_unbounded); + std::string type_id_kind_anonymous_sequence_SecondLevelElement_unbounded("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_SecondLevelElement_unbounded == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_SecondLevelElement_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_SecondLevelElement_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_SecondLevelElement_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_sub; + MemberId member_id_sub = 0x00000001; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure sub member TypeIdentifier inconsistent."); + return; + } + MemberName name_sub = "sub"; + eprosima::fastcdr::optional member_ann_builtin_sub; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_sub = TypeObjectUtils::build_complete_member_detail(name_sub, member_ann_builtin_sub, ann_custom_FirstLevelElement); + CompleteStructMember member_sub = TypeObjectUtils::build_complete_struct_member(common_sub, detail_sub); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_sub); + } + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_an_element_alone; + MemberId member_id_an_element_alone = 0x00000002; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure an_element_alone member TypeIdentifier inconsistent."); + return; + } + MemberName name_an_element_alone = "an_element_alone"; + eprosima::fastcdr::optional member_ann_builtin_an_element_alone; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_FirstLevelElement); + CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_an_element_alone); + } + CompleteStructType struct_type_FirstLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_FirstLevelElement, header_FirstLevelElement, member_seq_FirstLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_FirstLevelElement, type_name_FirstLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "FirstLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "FirstLevelElement", type_ids_FirstLevelElement); + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "FirstLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_complex_nested_arrays_type_identifier() +{ + { + StructTypeFlag struct_flags_complex_nested_arrays = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_complex_nested_arrays; + TypeIdentifierPair type_ids_complex_nested_arrays; + QualifiedTypeName type_name_complex_nested_arrays = "complex_nested_arrays"; + eprosima::fastcdr::optional type_ann_builtin_complex_nested_arrays; + eprosima::fastcdr::optional ann_custom_complex_nested_arrays; + CompleteTypeDetail detail_complex_nested_arrays = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_complex_nested_arrays, ann_custom_complex_nested_arrays, type_name_complex_nested_arrays.to_string()); + CompleteStructHeader header_complex_nested_arrays; + header_complex_nested_arrays = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_complex_nested_arrays); + CompleteStructMemberSeq member_seq_complex_nested_arrays; + { + return_code_complex_nested_arrays = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_FirstLevelElement_3", type_ids_complex_nested_arrays); + + if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_complex_nested_arrays = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "FirstLevelElement", type_ids_complex_nested_arrays); + + if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_FirstLevelElement; + TypeIdentifierPair type_ids_FirstLevelElement; + QualifiedTypeName type_name_FirstLevelElement = "FirstLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_FirstLevelElement; + eprosima::fastcdr::optional ann_custom_FirstLevelElement; + CompleteTypeDetail detail_FirstLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_FirstLevelElement, ann_custom_FirstLevelElement, type_name_FirstLevelElement.to_string()); + CompleteStructHeader header_FirstLevelElement; + header_FirstLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_FirstLevelElement); + CompleteStructMemberSeq member_seq_FirstLevelElement; + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_FirstLevelElement); + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_useless_name; + MemberId member_id_useless_name = 0x00000000; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure useless_name member TypeIdentifier inconsistent."); + return; + } + MemberName name_useless_name = "useless_name"; + eprosima::fastcdr::optional member_ann_builtin_useless_name; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_useless_name = TypeObjectUtils::build_complete_member_detail(name_useless_name, member_ann_builtin_useless_name, ann_custom_FirstLevelElement); + CompleteStructMember member_useless_name = TypeObjectUtils::build_complete_struct_member(common_useless_name, detail_useless_name); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_useless_name); + } + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_SecondLevelElement; + TypeIdentifierPair type_ids_SecondLevelElement; + QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; + eprosima::fastcdr::optional ann_custom_SecondLevelElement; + CompleteTypeDetail detail_SecondLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SecondLevelElement, ann_custom_SecondLevelElement, type_name_SecondLevelElement.to_string()); + CompleteStructHeader header_SecondLevelElement; + header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); + CompleteStructMemberSeq member_seq_SecondLevelElement; + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_an_element_alone; + MemberId member_id_an_element_alone = 0x00000000; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure an_element_alone member TypeIdentifier inconsistent."); + return; + } + MemberName name_an_element_alone = "an_element_alone"; + eprosima::fastcdr::optional member_ann_builtin_an_element_alone; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_SecondLevelElement); + CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); + } + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_SecondLevelElement); + + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {nullptr}; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; + if (TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; + PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); + std::string type_id_kind_anonymous_sequence_ThirdLevelElement_1("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_ThirdLevelElement_1 == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = static_cast(1); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 1; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_ThirdLevelElement_1")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_a_limited_other_value; + MemberId member_id_a_limited_other_value = 0x00000001; + if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure a_limited_other_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_a_limited_other_value = "a_limited_other_value"; + eprosima::fastcdr::optional member_ann_builtin_a_limited_other_value; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_a_limited_other_value = TypeObjectUtils::build_complete_member_detail(name_a_limited_other_value, member_ann_builtin_a_limited_other_value, ann_custom_SecondLevelElement); + CompleteStructMember member_a_limited_other_value = TypeObjectUtils::build_complete_struct_member(common_a_limited_other_value, detail_a_limited_other_value); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_a_limited_other_value); + } + CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "SecondLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_SecondLevelElement); + if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "SecondLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_sequence_SecondLevelElement_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_SecondLevelElement_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_SecondLevelElement_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_SecondLevelElement_unbounded, element_flags_anonymous_sequence_SecondLevelElement_unbounded); + std::string type_id_kind_anonymous_sequence_SecondLevelElement_unbounded("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_SecondLevelElement_unbounded == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_SecondLevelElement_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_SecondLevelElement_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_SecondLevelElement_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_sub; + MemberId member_id_sub = 0x00000001; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure sub member TypeIdentifier inconsistent."); + return; + } + MemberName name_sub = "sub"; + eprosima::fastcdr::optional member_ann_builtin_sub; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_sub = TypeObjectUtils::build_complete_member_detail(name_sub, member_ann_builtin_sub, ann_custom_FirstLevelElement); + CompleteStructMember member_sub = TypeObjectUtils::build_complete_struct_member(common_sub, detail_sub); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_sub); + } + { + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_FirstLevelElement); + + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_ThirdLevelElement; + TypeIdentifierPair type_ids_ThirdLevelElement; + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_x; + MemberId member_id_x = 0x00000000; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_ThirdLevelElement); + + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_y; + MemberId member_id_y = 0x00000001; + if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_an_element_alone; + MemberId member_id_an_element_alone = 0x00000002; + if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && + (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure an_element_alone member TypeIdentifier inconsistent."); + return; + } + MemberName name_an_element_alone = "an_element_alone"; + eprosima::fastcdr::optional member_ann_builtin_an_element_alone; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_FirstLevelElement); + CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_an_element_alone); + } + CompleteStructType struct_type_FirstLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_FirstLevelElement, header_FirstLevelElement, member_seq_FirstLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_FirstLevelElement, type_name_FirstLevelElement.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "FirstLevelElement already registered in TypeObjectRegistry for a different type."); + } + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "FirstLevelElement", type_ids_FirstLevelElement); + if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "FirstLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + TypeIdentifier* element_identifier_anonymous_array_FirstLevelElement_3 {nullptr}; + if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1()._d() || TK_NONE == type_ids_complex_nested_arrays.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_FirstLevelElement_3 = new TypeIdentifier(type_ids_complex_nested_arrays.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_FirstLevelElement_3 = new TypeIdentifier(type_ids_complex_nested_arrays.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_FirstLevelElement_3 = EK_COMPLETE; + if (TK_NONE == type_ids_complex_nested_arrays.type_identifier2()._d()) + { + equiv_kind_anonymous_array_FirstLevelElement_3 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_FirstLevelElement_3 = 0; + PlainCollectionHeader header_anonymous_array_FirstLevelElement_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_FirstLevelElement_3, element_flags_anonymous_array_FirstLevelElement_3); + std::string type_id_kind_anonymous_array_FirstLevelElement_3("TI_PLAIN_ARRAY_SMALL"); + if (type_id_kind_anonymous_array_FirstLevelElement_3 == "TI_PLAIN_ARRAY_SMALL") + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_FirstLevelElement_3, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_FirstLevelElement_3)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_FirstLevelElement_3")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_FirstLevelElement_3 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); + + PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_FirstLevelElement_3, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_FirstLevelElement_3)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_FirstLevelElement_3")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_FirstLevelElement_3 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_complex_nested_arrays = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_FirstLevelElement_3", type_ids_complex_nested_arrays); + if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_FirstLevelElement_3: Given Array TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_array_of_elements = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_array_of_elements; + MemberId member_id_array_of_elements = 0x00000000; + if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1()._d() || TK_NONE == type_ids_complex_nested_arrays.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_array_of_elements = TypeObjectUtils::build_common_struct_member(member_id_array_of_elements, member_flags_array_of_elements, type_ids_complex_nested_arrays.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && + (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_array_of_elements = TypeObjectUtils::build_common_struct_member(member_id_array_of_elements, member_flags_array_of_elements, type_ids_complex_nested_arrays.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure array_of_elements member TypeIdentifier inconsistent."); + return; + } + MemberName name_array_of_elements = "array_of_elements"; + eprosima::fastcdr::optional member_ann_builtin_array_of_elements; + ann_custom_complex_nested_arrays.reset(); + CompleteMemberDetail detail_array_of_elements = TypeObjectUtils::build_complete_member_detail(name_array_of_elements, member_ann_builtin_array_of_elements, ann_custom_complex_nested_arrays); + CompleteStructMember member_array_of_elements = TypeObjectUtils::build_complete_struct_member(common_array_of_elements, detail_array_of_elements); + TypeObjectUtils::add_complete_struct_member(member_seq_complex_nested_arrays, member_array_of_elements); + } + CompleteStructType struct_type_complex_nested_arrays = TypeObjectUtils::build_complete_struct_type(struct_flags_complex_nested_arrays, header_complex_nested_arrays, member_seq_complex_nested_arrays); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_complex_nested_arrays, type_name_complex_nested_arrays.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "complex_nested_arrays already registered in TypeObjectRegistry for a different type."); + } + return_code_complex_nested_arrays = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "complex_nested_arrays", type_ids_complex_nested_arrays); + if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "complex_nested_arrays: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp new file mode 100644 index 00000000..756845d0 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp @@ -0,0 +1,75 @@ +// 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 complex_nested_arraysTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_complex_nested_arrays_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register ThirdLevelElement related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_ThirdLevelElement_type_identifier(); +/** + * @brief Register SecondLevelElement related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_SecondLevelElement_type_identifier(); +/** + * @brief Register FirstLevelElement related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_FirstLevelElement_type_identifier(); +/** + * @brief Register complex_nested_arrays related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_complex_nested_arrays_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp similarity index 68% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_struct.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp index e90272ea..233d3ec4 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_struct.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp @@ -13,32 +13,17 @@ // limitations under the License. /*! - * @file enum_struct.h + * @file enum_struct.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "enum_structv1.h" +#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_HPP_ +#define _FAST_DDS_GENERATED_ENUM_STRUCT_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_H_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_H_ - -#include -#include #include -#include -#include -#include - -#include -#include -#include - - +#include #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,27 +49,16 @@ #define ENUM_STRUCT_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - /*! * @brief This class represents the enumeration ColorEnum defined by the user in the IDL file. * @ingroup enum_struct */ -enum ColorEnum : uint32_t +enum class ColorEnum : uint32_t { RED, GREEN, BLUE }; - - /*! * @brief This class represents the structure enum_struct defined by the user in the IDL file. * @ingroup enum_struct @@ -96,73 +70,117 @@ class enum_struct /*! * @brief Default constructor. */ - eProsima_user_DllExport enum_struct(); + eProsima_user_DllExport enum_struct() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~enum_struct(); + eProsima_user_DllExport ~enum_struct() + { + } /*! * @brief Copy constructor. * @param x Reference to the object enum_struct that will be copied. */ eProsima_user_DllExport enum_struct( - const enum_struct& x); + const enum_struct& x) + { + m_index = x.m_index; + + m_enum_value = x.m_enum_value; + + } /*! * @brief Move constructor. * @param x Reference to the object enum_struct that will be copied. */ eProsima_user_DllExport enum_struct( - enum_struct&& x) noexcept; + enum_struct&& x) noexcept + { + m_index = x.m_index; + m_enum_value = x.m_enum_value; + } /*! * @brief Copy assignment. * @param x Reference to the object enum_struct that will be copied. */ eProsima_user_DllExport enum_struct& operator =( - const enum_struct& x); + const enum_struct& x) + { + + m_index = x.m_index; + + m_enum_value = x.m_enum_value; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object enum_struct that will be copied. */ eProsima_user_DllExport enum_struct& operator =( - enum_struct&& x) noexcept; + enum_struct&& x) noexcept + { + + m_index = x.m_index; + m_enum_value = x.m_enum_value; + return *this; + } /*! * @brief Comparison operator. * @param x enum_struct object to compare. */ eProsima_user_DllExport bool operator ==( - const enum_struct& x) const; + const enum_struct& x) const + { + return (m_index == x.m_index && + m_enum_value == x.m_enum_value); + } /*! * @brief Comparison operator. * @param x enum_struct object to compare. */ eProsima_user_DllExport bool operator !=( - const enum_struct& x) const; + const enum_struct& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member index * @param _index New value for member index */ eProsima_user_DllExport void index( - uint32_t _index); + uint32_t _index) + { + m_index = _index; + } /*! * @brief This function returns the value of member index * @return Value of member index */ - eProsima_user_DllExport uint32_t index() const; + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } /*! * @brief This function returns a reference to member index * @return Reference to member index */ - eProsima_user_DllExport uint32_t& index(); + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } /*! @@ -170,29 +188,38 @@ class enum_struct * @param _enum_value New value for member enum_value */ eProsima_user_DllExport void enum_value( - ColorEnum _enum_value); + ColorEnum _enum_value) + { + m_enum_value = _enum_value; + } /*! * @brief This function returns the value of member enum_value * @return Value of member enum_value */ - eProsima_user_DllExport ColorEnum enum_value() const; + eProsima_user_DllExport ColorEnum enum_value() const + { + return m_enum_value; + } /*! * @brief This function returns a reference to member enum_value * @return Reference to member enum_value */ - eProsima_user_DllExport ColorEnum& enum_value(); + eProsima_user_DllExport ColorEnum& enum_value() + { + return m_enum_value; + } + + private: uint32_t m_index{0}; - ColorEnum m_enum_value{::RED}; + ColorEnum m_enum_value{ColorEnum::RED}; }; -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_H_ - +#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp index 5f7c61b4..9e1aa367 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_HPP_ #define _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_HPP_ -#include "enum_struct.h" +#include "enum_struct.hpp" constexpr uint32_t enum_struct_max_cdr_typesize {12UL}; constexpr uint32_t enum_struct_max_key_cdr_typesize {0UL}; @@ -35,8 +35,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const enum_struct& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp index 8528ff4e..28ac17b0 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx index 10f62bac..cf595921 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx @@ -19,18 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "enum_structPubSubTypes.h" +#include #include -#include "enum_structPubSubTypes.h" #include "enum_structCdrAux.hpp" +#include "enum_structTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - enum_structPubSubType::enum_structPubSubType() { setName("enum_struct"); @@ -219,3 +219,11 @@ bool enum_structPubSubType::getKey( return true; } +void enum_structPubSubType::register_type_object_representation() const +{ + register_enum_struct_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "enum_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h index 73e83613..a2a1a99e 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "enum_struct.h" +#include "enum_struct.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type enum_struct defined by the user in the IDL file. * @ingroup enum_struct @@ -90,10 +88,13 @@ class enum_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { - return false; + return true; } #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx new file mode 100644 index 00000000..e87ecad5 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx @@ -0,0 +1,264 @@ +// 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 enum_structTypeObjectSupport.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. + */ + +#include "enum_structTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "enum_struct.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_enum_struct_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_enum_struct_type_identifier(); + + }); +} + +void register_enum_struct_type_identifier() +{ + { + StructTypeFlag struct_flags_enum_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_enum_struct; + TypeIdentifierPair type_ids_enum_struct; + QualifiedTypeName type_name_enum_struct = "enum_struct"; + eprosima::fastcdr::optional type_ann_builtin_enum_struct; + eprosima::fastcdr::optional ann_custom_enum_struct; + CompleteTypeDetail detail_enum_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_enum_struct, ann_custom_enum_struct, type_name_enum_struct.to_string()); + CompleteStructHeader header_enum_struct; + header_enum_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_enum_struct); + CompleteStructMemberSeq member_seq_enum_struct; + { + return_code_enum_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_enum_struct); + + if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_index; + MemberId member_id_index = 0x00000000; + if (EK_COMPLETE == type_ids_enum_struct.type_identifier1()._d() || TK_NONE == type_ids_enum_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_enum_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_enum_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_enum_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_enum_struct.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_enum_struct); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_enum_struct, member_index); + } + { + return_code_enum_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ColorEnum", type_ids_enum_struct); + + if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EnumTypeFlag enum_flags_ColorEnum = 0; + BitBound bit_bound_ColorEnum = 32; + CommonEnumeratedHeader common_ColorEnum = TypeObjectUtils::build_common_enumerated_header(bit_bound_ColorEnum); + QualifiedTypeName type_name_ColorEnum = "ColorEnum"; + eprosima::fastcdr::optional type_ann_builtin_ColorEnum; + eprosima::fastcdr::optional ann_custom_ColorEnum; + CompleteTypeDetail detail_ColorEnum = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ColorEnum, ann_custom_ColorEnum, type_name_ColorEnum.to_string()); + CompleteEnumeratedHeader header_ColorEnum = TypeObjectUtils::build_complete_enumerated_header(common_ColorEnum, detail_ColorEnum); + CompleteEnumeratedLiteralSeq literal_seq_ColorEnum; + { + EnumeratedLiteralFlag flags_RED = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_RED = TypeObjectUtils::build_common_enumerated_literal(0, flags_RED); + eprosima::fastcdr::optional member_ann_builtin_RED; + ann_custom_ColorEnum.reset(); + MemberName name_RED = "RED"; + CompleteMemberDetail detail_RED = TypeObjectUtils::build_complete_member_detail(name_RED, member_ann_builtin_RED, ann_custom_ColorEnum); + CompleteEnumeratedLiteral literal_RED = TypeObjectUtils::build_complete_enumerated_literal(common_RED, detail_RED); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_RED); + } + { + EnumeratedLiteralFlag flags_GREEN = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_GREEN = TypeObjectUtils::build_common_enumerated_literal(1, flags_GREEN); + eprosima::fastcdr::optional member_ann_builtin_GREEN; + ann_custom_ColorEnum.reset(); + MemberName name_GREEN = "GREEN"; + CompleteMemberDetail detail_GREEN = TypeObjectUtils::build_complete_member_detail(name_GREEN, member_ann_builtin_GREEN, ann_custom_ColorEnum); + CompleteEnumeratedLiteral literal_GREEN = TypeObjectUtils::build_complete_enumerated_literal(common_GREEN, detail_GREEN); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_GREEN); + } + { + EnumeratedLiteralFlag flags_BLUE = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_BLUE = TypeObjectUtils::build_common_enumerated_literal(2, flags_BLUE); + eprosima::fastcdr::optional member_ann_builtin_BLUE; + ann_custom_ColorEnum.reset(); + MemberName name_BLUE = "BLUE"; + CompleteMemberDetail detail_BLUE = TypeObjectUtils::build_complete_member_detail(name_BLUE, member_ann_builtin_BLUE, ann_custom_ColorEnum); + CompleteEnumeratedLiteral literal_BLUE = TypeObjectUtils::build_complete_enumerated_literal(common_BLUE, detail_BLUE); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_BLUE); + } + CompleteEnumeratedType enumerated_type_ColorEnum = TypeObjectUtils::build_complete_enumerated_type(enum_flags_ColorEnum, header_ColorEnum, + literal_seq_ColorEnum); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_ColorEnum, type_name_ColorEnum.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ColorEnum already registered in TypeObjectRegistry for a different type."); + } + return_code_enum_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ColorEnum", type_ids_enum_struct); + if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ColorEnum: Given Enum TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_enum_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_enum_value; + MemberId member_id_enum_value = 0x00000001; + if (EK_COMPLETE == type_ids_enum_struct.type_identifier1()._d() || TK_NONE == type_ids_enum_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_enum_value = TypeObjectUtils::build_common_struct_member(member_id_enum_value, member_flags_enum_value, type_ids_enum_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_enum_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_enum_value = TypeObjectUtils::build_common_struct_member(member_id_enum_value, member_flags_enum_value, type_ids_enum_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure enum_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_enum_value = "enum_value"; + eprosima::fastcdr::optional member_ann_builtin_enum_value; + ann_custom_enum_struct.reset(); + CompleteMemberDetail detail_enum_value = TypeObjectUtils::build_complete_member_detail(name_enum_value, member_ann_builtin_enum_value, ann_custom_enum_struct); + CompleteStructMember member_enum_value = TypeObjectUtils::build_complete_struct_member(common_enum_value, detail_enum_value); + TypeObjectUtils::add_complete_struct_member(member_seq_enum_struct, member_enum_value); + } + CompleteStructType struct_type_enum_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_enum_struct, header_enum_struct, member_seq_enum_struct); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_enum_struct, type_name_enum_struct.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "enum_struct already registered in TypeObjectRegistry for a different type."); + } + return_code_enum_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "enum_struct", type_ids_enum_struct); + if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "enum_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp new file mode 100644 index 00000000..ca4873c2 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp @@ -0,0 +1,54 @@ +// 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 enum_structTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_enum_struct_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register enum_struct related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_enum_struct_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequence.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp similarity index 72% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequence.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp index 589247f3..983bb95d 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequence.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp @@ -13,32 +13,19 @@ // limitations under the License. /*! - * @file float_bounded_sequence.h + * @file float_bounded_sequence.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "float_bounded_sequencev1.h" +#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_HPP_ +#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ - -#include -#include #include -#include -#include +#include #include -#include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,19 +51,6 @@ #define FLOAT_BOUNDED_SEQUENCE_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - - - /*! * @brief This class represents the structure float_bounded_sequence defined by the user in the IDL file. * @ingroup float_bounded_sequence @@ -88,80 +62,122 @@ class float_bounded_sequence /*! * @brief Default constructor. */ - eProsima_user_DllExport float_bounded_sequence(); + eProsima_user_DllExport float_bounded_sequence() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~float_bounded_sequence(); + eProsima_user_DllExport ~float_bounded_sequence() + { + } /*! * @brief Copy constructor. * @param x Reference to the object float_bounded_sequence that will be copied. */ eProsima_user_DllExport float_bounded_sequence( - const float_bounded_sequence& x); + const float_bounded_sequence& x) + { + m_numbers = x.m_numbers; + + } /*! * @brief Move constructor. * @param x Reference to the object float_bounded_sequence that will be copied. */ eProsima_user_DllExport float_bounded_sequence( - float_bounded_sequence&& x) noexcept; + float_bounded_sequence&& x) noexcept + { + m_numbers = std::move(x.m_numbers); + } /*! * @brief Copy assignment. * @param x Reference to the object float_bounded_sequence that will be copied. */ eProsima_user_DllExport float_bounded_sequence& operator =( - const float_bounded_sequence& x); + const float_bounded_sequence& x) + { + + m_numbers = x.m_numbers; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object float_bounded_sequence that will be copied. */ eProsima_user_DllExport float_bounded_sequence& operator =( - float_bounded_sequence&& x) noexcept; + float_bounded_sequence&& x) noexcept + { + + m_numbers = std::move(x.m_numbers); + return *this; + } /*! * @brief Comparison operator. * @param x float_bounded_sequence object to compare. */ eProsima_user_DllExport bool operator ==( - const float_bounded_sequence& x) const; + const float_bounded_sequence& x) const + { + return (m_numbers == x.m_numbers); + } /*! * @brief Comparison operator. * @param x float_bounded_sequence object to compare. */ eProsima_user_DllExport bool operator !=( - const float_bounded_sequence& x) const; + const float_bounded_sequence& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member numbers * @param _numbers New value to be copied in member numbers */ eProsima_user_DllExport void numbers( - const std::vector& _numbers); + const std::vector& _numbers) + { + m_numbers = _numbers; + } /*! * @brief This function moves the value in member numbers * @param _numbers New value to be moved in member numbers */ eProsima_user_DllExport void numbers( - std::vector&& _numbers); + std::vector&& _numbers) + { + m_numbers = std::move(_numbers); + } /*! * @brief This function returns a constant reference to member numbers * @return Constant reference to member numbers */ - eProsima_user_DllExport const std::vector& numbers() const; + eProsima_user_DllExport const std::vector& numbers() const + { + return m_numbers; + } /*! * @brief This function returns a reference to member numbers * @return Reference to member numbers */ - eProsima_user_DllExport std::vector& numbers(); + eProsima_user_DllExport std::vector& numbers() + { + return m_numbers; + } + + private: @@ -169,8 +185,6 @@ class float_bounded_sequence }; -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ - +#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp index 3dd5f268..432e9029 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_HPP_ #define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_HPP_ -#include "float_bounded_sequence.h" +#include "float_bounded_sequence.hpp" constexpr uint32_t float_bounded_sequence_max_cdr_typesize {60UL}; constexpr uint32_t float_bounded_sequence_max_key_cdr_typesize {0UL}; @@ -34,10 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const float_bounded_sequence& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp index 38b04790..9903c557 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp @@ -34,10 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx similarity index 95% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencePubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx index 4fba25e6..1aea39f7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx @@ -19,20 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "float_bounded_sequencePubSubTypes.h" +#include #include -#include "float_bounded_sequencePubSubTypes.h" #include "float_bounded_sequenceCdrAux.hpp" +#include "float_bounded_sequenceTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - - float_bounded_sequencePubSubType::float_bounded_sequencePubSubType() { setName("float_bounded_sequence"); @@ -221,3 +219,11 @@ bool float_bounded_sequencePubSubType::getKey( return true; } +void float_bounded_sequencePubSubType::register_type_object_representation() const +{ + register_float_bounded_sequence_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "float_bounded_sequenceCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencePubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h index cbdad218..9ce67a10 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "float_bounded_sequence.h" +#include "float_bounded_sequence.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,10 +38,6 @@ #endif // GEN_API_VER - - - - /*! * @brief This class represents the TopicDataType of the type float_bounded_sequence defined by the user in the IDL file. * @ingroup float_bounded_sequence @@ -92,6 +88,9 @@ class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDat eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx new file mode 100644 index 00000000..466dba67 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx @@ -0,0 +1,238 @@ +// 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 float_bounded_sequenceTypeObjectSupport.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. + */ + +#include "float_bounded_sequenceTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "float_bounded_sequence.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_float_bounded_sequence_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_float_bounded_sequence_type_identifier(); + + }); +} + +void register_float_bounded_sequence_type_identifier() +{ + { + StructTypeFlag struct_flags_float_bounded_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_float_bounded_sequence; + TypeIdentifierPair type_ids_float_bounded_sequence; + QualifiedTypeName type_name_float_bounded_sequence = "float_bounded_sequence"; + eprosima::fastcdr::optional type_ann_builtin_float_bounded_sequence; + eprosima::fastcdr::optional ann_custom_float_bounded_sequence; + CompleteTypeDetail detail_float_bounded_sequence = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_float_bounded_sequence, ann_custom_float_bounded_sequence, type_name_float_bounded_sequence.to_string()); + CompleteStructHeader header_float_bounded_sequence; + header_float_bounded_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_float_bounded_sequence); + CompleteStructMemberSeq member_seq_float_bounded_sequence; + { + return_code_float_bounded_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_float_13", type_ids_float_bounded_sequence); + + if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_float_bounded_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_float_bounded_sequence); + + if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + TypeIdentifier* element_identifier_anonymous_sequence_float_13 {nullptr}; + if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1()._d() || TK_NONE == type_ids_float_bounded_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_float_13 = new TypeIdentifier(type_ids_float_bounded_sequence.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_sequence_float_13 = new TypeIdentifier(type_ids_float_bounded_sequence.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_float_13 = EK_COMPLETE; + if (TK_NONE == type_ids_float_bounded_sequence.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_float_13 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_float_13 = 0; + PlainCollectionHeader header_anonymous_sequence_float_13 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_float_13, element_flags_anonymous_sequence_float_13); + std::string type_id_kind_anonymous_sequence_float_13("TI_PLAIN_SEQUENCE_SMALL"); + if (type_id_kind_anonymous_sequence_float_13 == "TI_PLAIN_SEQUENCE_SMALL") + { + SBound bound = static_cast(13); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_float_13, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_float_13)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_float_13")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_float_13 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 13; + PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_float_13, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_float_13)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_float_13")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_float_13 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_float_bounded_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_float_13", type_ids_float_bounded_sequence); + if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_float_13: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_numbers = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_numbers; + MemberId member_id_numbers = 0x00000000; + if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1()._d() || TK_NONE == type_ids_float_bounded_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_numbers = TypeObjectUtils::build_common_struct_member(member_id_numbers, member_flags_numbers, type_ids_float_bounded_sequence.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && + (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_numbers = TypeObjectUtils::build_common_struct_member(member_id_numbers, member_flags_numbers, type_ids_float_bounded_sequence.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure numbers member TypeIdentifier inconsistent."); + return; + } + MemberName name_numbers = "numbers"; + eprosima::fastcdr::optional member_ann_builtin_numbers; + ann_custom_float_bounded_sequence.reset(); + CompleteMemberDetail detail_numbers = TypeObjectUtils::build_complete_member_detail(name_numbers, member_ann_builtin_numbers, ann_custom_float_bounded_sequence); + CompleteStructMember member_numbers = TypeObjectUtils::build_complete_struct_member(common_numbers, detail_numbers); + TypeObjectUtils::add_complete_struct_member(member_seq_float_bounded_sequence, member_numbers); + } + CompleteStructType struct_type_float_bounded_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_float_bounded_sequence, header_float_bounded_sequence, member_seq_float_bounded_sequence); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_float_bounded_sequence, type_name_float_bounded_sequence.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "float_bounded_sequence already registered in TypeObjectRegistry for a different type."); + } + return_code_float_bounded_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "float_bounded_sequence", type_ids_float_bounded_sequence); + if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "float_bounded_sequence: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp new file mode 100644 index 00000000..8db0697d --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp @@ -0,0 +1,54 @@ +// 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 float_bounded_sequenceTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_float_bounded_sequence_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register float_bounded_sequence related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_float_bounded_sequence_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_world.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp similarity index 69% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_world.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp index 0b5eaad1..282793dd 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_world.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp @@ -13,32 +13,19 @@ // limitations under the License. /*! - * @file hello_world.h + * @file hello_world.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "hello_worldv1.h" +#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_HPP_ +#define _FAST_DDS_GENERATED_HELLO_WORLD_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_H_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_H_ - -#include -#include #include -#include #include -#include - +#include #include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +51,6 @@ #define HELLO_WORLD_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure hello_world defined by the user in the IDL file. * @ingroup hello_world @@ -86,73 +62,117 @@ class hello_world /*! * @brief Default constructor. */ - eProsima_user_DllExport hello_world(); + eProsima_user_DllExport hello_world() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~hello_world(); + eProsima_user_DllExport ~hello_world() + { + } /*! * @brief Copy constructor. * @param x Reference to the object hello_world that will be copied. */ eProsima_user_DllExport hello_world( - const hello_world& x); + const hello_world& x) + { + m_index = x.m_index; + + m_message = x.m_message; + + } /*! * @brief Move constructor. * @param x Reference to the object hello_world that will be copied. */ eProsima_user_DllExport hello_world( - hello_world&& x) noexcept; + hello_world&& x) noexcept + { + m_index = x.m_index; + m_message = std::move(x.m_message); + } /*! * @brief Copy assignment. * @param x Reference to the object hello_world that will be copied. */ eProsima_user_DllExport hello_world& operator =( - const hello_world& x); + const hello_world& x) + { + + m_index = x.m_index; + + m_message = x.m_message; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object hello_world that will be copied. */ eProsima_user_DllExport hello_world& operator =( - hello_world&& x) noexcept; + hello_world&& x) noexcept + { + + m_index = x.m_index; + m_message = std::move(x.m_message); + return *this; + } /*! * @brief Comparison operator. * @param x hello_world object to compare. */ eProsima_user_DllExport bool operator ==( - const hello_world& x) const; + const hello_world& x) const + { + return (m_index == x.m_index && + m_message == x.m_message); + } /*! * @brief Comparison operator. * @param x hello_world object to compare. */ eProsima_user_DllExport bool operator !=( - const hello_world& x) const; + const hello_world& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member index * @param _index New value for member index */ eProsima_user_DllExport void index( - uint32_t _index); + uint32_t _index) + { + m_index = _index; + } /*! * @brief This function returns the value of member index * @return Value of member index */ - eProsima_user_DllExport uint32_t index() const; + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } /*! * @brief This function returns a reference to member index * @return Reference to member index */ - eProsima_user_DllExport uint32_t& index(); + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } /*! @@ -160,26 +180,40 @@ class hello_world * @param _message New value to be copied in member message */ eProsima_user_DllExport void message( - const std::string& _message); + const std::string& _message) + { + m_message = _message; + } /*! * @brief This function moves the value in member message * @param _message New value to be moved in member message */ eProsima_user_DllExport void message( - std::string&& _message); + std::string&& _message) + { + m_message = std::move(_message); + } /*! * @brief This function returns a constant reference to member message * @return Constant reference to member message */ - eProsima_user_DllExport const std::string& message() const; + eProsima_user_DllExport const std::string& message() const + { + return m_message; + } /*! * @brief This function returns a reference to member message * @return Reference to member message */ - eProsima_user_DllExport std::string& message(); + eProsima_user_DllExport std::string& message() + { + return m_message; + } + + private: @@ -188,8 +222,6 @@ class hello_world }; -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_H_ - +#endif // _FAST_DDS_GENERATED_HELLO_WORLD_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp index 06dd7ebb..80a73b13 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_HPP_ #define _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_HPP_ -#include "hello_world.h" +#include "hello_world.hpp" constexpr uint32_t hello_world_max_cdr_typesize {268UL}; constexpr uint32_t hello_world_max_key_cdr_typesize {0UL}; @@ -34,8 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const hello_world& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp index cc6654cd..1f22846b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx index a3b93e2f..96b24dc4 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx @@ -19,18 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "hello_worldPubSubTypes.h" +#include #include -#include "hello_worldPubSubTypes.h" #include "hello_worldCdrAux.hpp" +#include "hello_worldTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - hello_worldPubSubType::hello_worldPubSubType() { setName("hello_world"); @@ -219,3 +219,11 @@ bool hello_worldPubSubType::getKey( return true; } +void hello_worldPubSubType::register_type_object_representation() const +{ + register_hello_world_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "hello_worldCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h index 69aa2245..a32015e0 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "hello_world.h" +#include "hello_world.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type hello_world defined by the user in the IDL file. * @ingroup hello_world @@ -90,6 +88,9 @@ class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx new file mode 100644 index 00000000..25cc8af3 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx @@ -0,0 +1,248 @@ +// 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 hello_worldTypeObjectSupport.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. + */ + +#include "hello_worldTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hello_world.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_hello_world_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_hello_world_type_identifier(); + + }); +} + +void register_hello_world_type_identifier() +{ + { + StructTypeFlag struct_flags_hello_world = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_hello_world; + TypeIdentifierPair type_ids_hello_world; + QualifiedTypeName type_name_hello_world = "hello_world"; + eprosima::fastcdr::optional type_ann_builtin_hello_world; + eprosima::fastcdr::optional ann_custom_hello_world; + CompleteTypeDetail detail_hello_world = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_hello_world, ann_custom_hello_world, type_name_hello_world.to_string()); + CompleteStructHeader header_hello_world; + header_hello_world = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_hello_world); + CompleteStructMemberSeq member_seq_hello_world; + { + return_code_hello_world = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_hello_world); + + if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_index; + MemberId member_id_index = 0x00000000; + if (EK_COMPLETE == type_ids_hello_world.type_identifier1()._d() || TK_NONE == type_ids_hello_world.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier1()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier1()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_hello_world.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_hello_world.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier2()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier2()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_hello_world.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_hello_world.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_hello_world); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_hello_world, member_index); + } + { + return_code_hello_world = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_hello_world); + + if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_hello_world = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_hello_world); + if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_message; + MemberId member_id_message = 0x00000001; + if (EK_COMPLETE == type_ids_hello_world.type_identifier1()._d() || TK_NONE == type_ids_hello_world.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier1()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier1()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier1()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_hello_world.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_hello_world.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier2()._d() && + EK_COMPLETE == type_ids_hello_world.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier2()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier2()._d() && + (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_hello_world.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure message member TypeIdentifier inconsistent."); + return; + } + MemberName name_message = "message"; + eprosima::fastcdr::optional member_ann_builtin_message; + ann_custom_hello_world.reset(); + CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_hello_world); + CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message); + TypeObjectUtils::add_complete_struct_member(member_seq_hello_world, member_message); + } + CompleteStructType struct_type_hello_world = TypeObjectUtils::build_complete_struct_type(struct_flags_hello_world, header_hello_world, member_seq_hello_world); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_hello_world, type_name_hello_world.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "hello_world already registered in TypeObjectRegistry for a different type."); + } + return_code_hello_world = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "hello_world", type_ids_hello_world); + if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "hello_world: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp new file mode 100644 index 00000000..9c2829f4 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp @@ -0,0 +1,54 @@ +// 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 hello_worldTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_hello_world_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register hello_world related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_hello_world_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp similarity index 75% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_struct.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp index 56466950..bbc4bdc8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_struct.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp @@ -13,32 +13,20 @@ // limitations under the License. /*! - * @file map_struct.h + * @file map_struct.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "map_structv1.h" +#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_HPP_ +#define _FAST_DDS_GENERATED_MAP_STRUCT_HPP_ -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_H_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_H_ - -#include -#include #include #include #include -#include - +#include #include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,19 +52,6 @@ #define MAP_STRUCT_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - - - /*! * @brief This class represents the structure map_struct defined by the user in the IDL file. * @ingroup map_struct @@ -88,80 +63,122 @@ class map_struct /*! * @brief Default constructor. */ - eProsima_user_DllExport map_struct(); + eProsima_user_DllExport map_struct() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~map_struct(); + eProsima_user_DllExport ~map_struct() + { + } /*! * @brief Copy constructor. * @param x Reference to the object map_struct that will be copied. */ eProsima_user_DllExport map_struct( - const map_struct& x); + const map_struct& x) + { + m_my_map = x.m_my_map; + + } /*! * @brief Move constructor. * @param x Reference to the object map_struct that will be copied. */ eProsima_user_DllExport map_struct( - map_struct&& x) noexcept; + map_struct&& x) noexcept + { + m_my_map = std::move(x.m_my_map); + } /*! * @brief Copy assignment. * @param x Reference to the object map_struct that will be copied. */ eProsima_user_DllExport map_struct& operator =( - const map_struct& x); + const map_struct& x) + { + + m_my_map = x.m_my_map; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object map_struct that will be copied. */ eProsima_user_DllExport map_struct& operator =( - map_struct&& x) noexcept; + map_struct&& x) noexcept + { + + m_my_map = std::move(x.m_my_map); + return *this; + } /*! * @brief Comparison operator. * @param x map_struct object to compare. */ eProsima_user_DllExport bool operator ==( - const map_struct& x) const; + const map_struct& x) const + { + return (m_my_map == x.m_my_map); + } /*! * @brief Comparison operator. * @param x map_struct object to compare. */ eProsima_user_DllExport bool operator !=( - const map_struct& x) const; + const map_struct& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member my_map * @param _my_map New value to be copied in member my_map */ eProsima_user_DllExport void my_map( - const std::map& _my_map); + const std::map& _my_map) + { + m_my_map = _my_map; + } /*! * @brief This function moves the value in member my_map * @param _my_map New value to be moved in member my_map */ eProsima_user_DllExport void my_map( - std::map&& _my_map); + std::map&& _my_map) + { + m_my_map = std::move(_my_map); + } /*! * @brief This function returns a constant reference to member my_map * @return Constant reference to member my_map */ - eProsima_user_DllExport const std::map& my_map() const; + eProsima_user_DllExport const std::map& my_map() const + { + return m_my_map; + } /*! * @brief This function returns a reference to member my_map * @return Reference to member my_map */ - eProsima_user_DllExport std::map& my_map(); + eProsima_user_DllExport std::map& my_map() + { + return m_my_map; + } + + private: @@ -169,8 +186,6 @@ class map_struct }; -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_H_ - +#endif // _FAST_DDS_GENERATED_MAP_STRUCT_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp similarity index 93% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp index 54604acc..be6fde96 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp @@ -22,9 +22,9 @@ #ifndef _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_HPP_ #define _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_HPP_ -#include "map_struct.h" +#include "map_struct.hpp" -constexpr uint32_t map_struct_max_cdr_typesize {26405UL}; +constexpr uint32_t map_struct_max_cdr_typesize {8UL}; constexpr uint32_t map_struct_max_key_cdr_typesize {0UL}; @@ -34,10 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const map_struct& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp index c8c4e2a9..e49ea33b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp @@ -34,10 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx index c6912f0c..539bfbe0 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx @@ -19,20 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "map_structPubSubTypes.h" +#include #include -#include "map_structPubSubTypes.h" #include "map_structCdrAux.hpp" +#include "map_structTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - - map_structPubSubType::map_structPubSubType() { setName("map_struct"); @@ -221,3 +219,11 @@ bool map_structPubSubType::getKey( return true; } +void map_structPubSubType::register_type_object_representation() const +{ + register_map_struct_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "map_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h index 9ce0fd50..22f7d998 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "map_struct.h" +#include "map_struct.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,10 +38,6 @@ #endif // GEN_API_VER - - - - /*! * @brief This class represents the TopicDataType of the type map_struct defined by the user in the IDL file. * @ingroup map_struct @@ -92,6 +88,9 @@ class map_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx new file mode 100644 index 00000000..3184897e --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx @@ -0,0 +1,337 @@ +// 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 map_structTypeObjectSupport.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. + */ + +#include "map_structTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "map_struct.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_map_struct_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_map_struct_type_identifier(); + + }); +} + +void register_map_struct_type_identifier() +{ + { + StructTypeFlag struct_flags_map_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_map_struct; + TypeIdentifierPair type_ids_map_struct; + QualifiedTypeName type_name_map_struct = "map_struct"; + eprosima::fastcdr::optional type_ann_builtin_map_struct; + eprosima::fastcdr::optional ann_custom_map_struct; + CompleteTypeDetail detail_map_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_map_struct, ann_custom_map_struct, type_name_map_struct.to_string()); + CompleteStructHeader header_map_struct; + header_map_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_map_struct); + CompleteStructMemberSeq member_seq_map_struct; + { + return_code_map_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_map_struct); + + if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_map_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_map_struct); + + if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Map element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + TypeIdentifier* element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_map_struct.type_identifier1()._d() || TK_NONE == type_ids_map_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_map_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_map_anonymous_string_unbounded_bool_unbounded inconsistent element TypeIdentifier."); + return; + } + return_code_map_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_map_struct); + + if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_map_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_map_struct); + if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + TypeIdentifier* key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {nullptr}; + if (EK_COMPLETE == type_ids_map_struct.type_identifier1()._d() || TK_NONE == type_ids_map_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_map_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_map_anonymous_string_unbounded_bool_unbounded inconsistent key TypeIdentifier."); + return; + } + EquivalenceKind equiv_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded = EK_BOTH; + if ((EK_COMPLETE == key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() || EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d()) || + (TI_PLAIN_SEQUENCE_SMALL == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && (EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_sdefn().key_identifier()->_d() || EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_sdefn().header().equiv_kind())) || + (TI_PLAIN_MAP_LARGE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && (EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_ldefn().key_identifier()->_d() || EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_ldefn().header().equiv_kind()))) + { + equiv_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded = EK_COMPLETE; + } + CollectionElementFlag element_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded = 0; + CollectionElementFlag key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded = 0; + PlainCollectionHeader header_anonymous_map_anonymous_string_unbounded_bool_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded, element_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded); + std::string type_id_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded("TI_PLAIN_MAP_SMALL"); + if (type_id_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded == "TI_PLAIN_MAP_SMALL") + { + SBound bound = 0; + PlainMapSTypeDefn map_sdefn = TypeObjectUtils::build_plain_map_s_type_defn(header_anonymous_map_anonymous_string_unbounded_bool_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded), key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded, + eprosima::fastcdr::external(key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_map_type_identifier(map_sdefn, "anonymous_map_anonymous_string_unbounded_bool_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_map_anonymous_string_unbounded_bool_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBound bound = 0; + PlainMapLTypeDefn map_ldefn = TypeObjectUtils::build_plain_map_l_type_defn(header_anonymous_map_anonymous_string_unbounded_bool_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded), key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded, + eprosima::fastcdr::external(key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_map_type_identifier(map_ldefn, "anonymous_map_anonymous_string_unbounded_bool_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_map_anonymous_string_unbounded_bool_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + return_code_map_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_map_struct); + if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_map_anonymous_string_unbounded_bool_unbounded: Given Map TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_my_map = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_my_map; + MemberId member_id_my_map = 0x00000000; + if (EK_COMPLETE == type_ids_map_struct.type_identifier1()._d() || TK_NONE == type_ids_map_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_my_map = TypeObjectUtils::build_common_struct_member(member_id_my_map, member_flags_my_map, type_ids_map_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_map_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_map_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_my_map = TypeObjectUtils::build_common_struct_member(member_id_my_map, member_flags_my_map, type_ids_map_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure my_map member TypeIdentifier inconsistent."); + return; + } + MemberName name_my_map = "my_map"; + eprosima::fastcdr::optional member_ann_builtin_my_map; + ann_custom_map_struct.reset(); + CompleteMemberDetail detail_my_map = TypeObjectUtils::build_complete_member_detail(name_my_map, member_ann_builtin_my_map, ann_custom_map_struct); + CompleteStructMember member_my_map = TypeObjectUtils::build_complete_struct_member(common_my_map, detail_my_map); + TypeObjectUtils::add_complete_struct_member(member_seq_map_struct, member_my_map); + } + CompleteStructType struct_type_map_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_map_struct, header_map_struct, member_seq_map_struct); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_map_struct, type_name_map_struct.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "map_struct already registered in TypeObjectRegistry for a different type."); + } + return_code_map_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "map_struct", type_ids_map_struct); + if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "map_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp new file mode 100644 index 00000000..98d413c6 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp @@ -0,0 +1,54 @@ +// 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 map_structTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_map_struct_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register map_struct related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_map_struct_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_array.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp similarity index 73% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_array.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp index 60777854..7ae80c45 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_array.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp @@ -13,32 +13,18 @@ // limitations under the License. /*! - * @file numeric_array.h + * @file numeric_array.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "numeric_arrayv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ +#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_HPP_ +#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_HPP_ #include -#include #include -#include -#include -#include - -#include -#include -#include - - +#include #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +50,6 @@ #define NUMERIC_ARRAY_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure numeric_array defined by the user in the IDL file. * @ingroup numeric_array @@ -86,80 +61,122 @@ class numeric_array /*! * @brief Default constructor. */ - eProsima_user_DllExport numeric_array(); + eProsima_user_DllExport numeric_array() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~numeric_array(); + eProsima_user_DllExport ~numeric_array() + { + } /*! * @brief Copy constructor. * @param x Reference to the object numeric_array that will be copied. */ eProsima_user_DllExport numeric_array( - const numeric_array& x); + const numeric_array& x) + { + m_points = x.m_points; + + } /*! * @brief Move constructor. * @param x Reference to the object numeric_array that will be copied. */ eProsima_user_DllExport numeric_array( - numeric_array&& x) noexcept; + numeric_array&& x) noexcept + { + m_points = std::move(x.m_points); + } /*! * @brief Copy assignment. * @param x Reference to the object numeric_array that will be copied. */ eProsima_user_DllExport numeric_array& operator =( - const numeric_array& x); + const numeric_array& x) + { + + m_points = x.m_points; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object numeric_array that will be copied. */ eProsima_user_DllExport numeric_array& operator =( - numeric_array&& x) noexcept; + numeric_array&& x) noexcept + { + + m_points = std::move(x.m_points); + return *this; + } /*! * @brief Comparison operator. * @param x numeric_array object to compare. */ eProsima_user_DllExport bool operator ==( - const numeric_array& x) const; + const numeric_array& x) const + { + return (m_points == x.m_points); + } /*! * @brief Comparison operator. * @param x numeric_array object to compare. */ eProsima_user_DllExport bool operator !=( - const numeric_array& x) const; + const numeric_array& x) const + { + return !(*this == x); + } /*! * @brief This function copies the value in member points * @param _points New value to be copied in member points */ eProsima_user_DllExport void points( - const std::array& _points); + const std::array& _points) + { + m_points = _points; + } /*! * @brief This function moves the value in member points * @param _points New value to be moved in member points */ eProsima_user_DllExport void points( - std::array&& _points); + std::array&& _points) + { + m_points = std::move(_points); + } /*! * @brief This function returns a constant reference to member points * @return Constant reference to member points */ - eProsima_user_DllExport const std::array& points() const; + eProsima_user_DllExport const std::array& points() const + { + return m_points; + } /*! * @brief This function returns a reference to member points * @return Reference to member points */ - eProsima_user_DllExport std::array& points(); + eProsima_user_DllExport std::array& points() + { + return m_points; + } + + private: @@ -167,8 +184,6 @@ class numeric_array }; -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ - +#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp index 29e623c1..a058c1a8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_HPP_ #define _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_HPP_ -#include "numeric_array.h" +#include "numeric_array.hpp" constexpr uint32_t numeric_array_max_cdr_typesize {16UL}; constexpr uint32_t numeric_array_max_key_cdr_typesize {0UL}; @@ -34,8 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const numeric_array& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp similarity index 99% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp index 81c35d24..41c1c7ad 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx index ad9c3508..0db9f668 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx @@ -19,18 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "numeric_arrayPubSubTypes.h" +#include #include -#include "numeric_arrayPubSubTypes.h" #include "numeric_arrayCdrAux.hpp" +#include "numeric_arrayTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - numeric_arrayPubSubType::numeric_arrayPubSubType() { setName("numeric_array"); @@ -219,3 +219,11 @@ bool numeric_arrayPubSubType::getKey( return true; } +void numeric_arrayPubSubType::register_type_object_representation() const +{ + register_numeric_array_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "numeric_arrayCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h index 413df6d9..f8d59b12 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "numeric_array.h" +#include "numeric_array.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,8 +38,6 @@ #endif // GEN_API_VER - - /*! * @brief This class represents the TopicDataType of the type numeric_array defined by the user in the IDL file. * @ingroup numeric_array @@ -90,6 +88,9 @@ class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx new file mode 100644 index 00000000..70c96e42 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx @@ -0,0 +1,242 @@ +// 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 numeric_arrayTypeObjectSupport.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. + */ + +#include "numeric_arrayTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "numeric_array.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_numeric_array_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_numeric_array_type_identifier(); + + }); +} + +void register_numeric_array_type_identifier() +{ + { + StructTypeFlag struct_flags_numeric_array = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_numeric_array; + TypeIdentifierPair type_ids_numeric_array; + QualifiedTypeName type_name_numeric_array = "numeric_array"; + eprosima::fastcdr::optional type_ann_builtin_numeric_array; + eprosima::fastcdr::optional ann_custom_numeric_array; + CompleteTypeDetail detail_numeric_array = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_numeric_array, ann_custom_numeric_array, type_name_numeric_array.to_string()); + CompleteStructHeader header_numeric_array; + header_numeric_array = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_numeric_array); + CompleteStructMemberSeq member_seq_numeric_array; + { + return_code_numeric_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_int32_t_3", type_ids_numeric_array); + + if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) + { + return_code_numeric_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_numeric_array); + + if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + TypeIdentifier* element_identifier_anonymous_array_int32_t_3 {nullptr}; + if (EK_COMPLETE == type_ids_numeric_array.type_identifier1()._d() || TK_NONE == type_ids_numeric_array.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier1()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier1()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_int32_t_3 = new TypeIdentifier(type_ids_numeric_array.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_numeric_array.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier2()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier2()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + element_identifier_anonymous_array_int32_t_3 = new TypeIdentifier(type_ids_numeric_array.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_int32_t_3 = EK_COMPLETE; + if (TK_NONE == type_ids_numeric_array.type_identifier2()._d()) + { + equiv_kind_anonymous_array_int32_t_3 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_int32_t_3 = 0; + PlainCollectionHeader header_anonymous_array_int32_t_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_int32_t_3, element_flags_anonymous_array_int32_t_3); + std::string type_id_kind_anonymous_array_int32_t_3("TI_PLAIN_ARRAY_SMALL"); + if (type_id_kind_anonymous_array_int32_t_3 == "TI_PLAIN_ARRAY_SMALL") + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_int32_t_3, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_int32_t_3)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_int32_t_3")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_int32_t_3 already registered in TypeObjectRegistry for a different type."); + } + } + else + { + LBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); + + PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_int32_t_3, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_int32_t_3)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_int32_t_3")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_int32_t_3 already registered in TypeObjectRegistry for a different type."); + } + } + return_code_numeric_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_int32_t_3", type_ids_numeric_array); + if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_int32_t_3: Given Array TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + StructMemberFlag member_flags_points = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_points; + MemberId member_id_points = 0x00000000; + if (EK_COMPLETE == type_ids_numeric_array.type_identifier1()._d() || TK_NONE == type_ids_numeric_array.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier1()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier1()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier1()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_points = TypeObjectUtils::build_common_struct_member(member_id_points, member_flags_points, type_ids_numeric_array.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_numeric_array.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier2()._d() && + EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier2()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier2()._d() && + (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_points = TypeObjectUtils::build_common_struct_member(member_id_points, member_flags_points, type_ids_numeric_array.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure points member TypeIdentifier inconsistent."); + return; + } + MemberName name_points = "points"; + eprosima::fastcdr::optional member_ann_builtin_points; + ann_custom_numeric_array.reset(); + CompleteMemberDetail detail_points = TypeObjectUtils::build_complete_member_detail(name_points, member_ann_builtin_points, ann_custom_numeric_array); + CompleteStructMember member_points = TypeObjectUtils::build_complete_struct_member(common_points, detail_points); + TypeObjectUtils::add_complete_struct_member(member_seq_numeric_array, member_points); + } + CompleteStructType struct_type_numeric_array = TypeObjectUtils::build_complete_struct_type(struct_flags_numeric_array, header_numeric_array, member_seq_numeric_array); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_numeric_array, type_name_numeric_array.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "numeric_array already registered in TypeObjectRegistry for a different type."); + } + return_code_numeric_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "numeric_array", type_ids_numeric_array); + if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "numeric_array: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp new file mode 100644 index 00000000..5801dc0e --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp @@ -0,0 +1,54 @@ +// 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 numeric_arrayTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_numeric_array_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register numeric_array related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_numeric_array_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp new file mode 100644 index 00000000..20aad0b7 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp @@ -0,0 +1,676 @@ +// 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 union_struct.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_HPP_ +#define _FAST_DDS_GENERATED_UNION_STRUCT_HPP_ + +#include +#include +#include +#include +#include +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(UNION_STRUCT_SOURCE) +#define UNION_STRUCT_DllAPI __declspec( dllexport ) +#else +#define UNION_STRUCT_DllAPI __declspec( dllimport ) +#endif // UNION_STRUCT_SOURCE +#else +#define UNION_STRUCT_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define UNION_STRUCT_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the union MyUnion defined by the user in the IDL file. + * @ingroup union_struct + */ +class MyUnion +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport MyUnion() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~MyUnion() + { + if (member_destructor_) + { + member_destructor_(); + } + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object MyUnion that will be copied. + */ + eProsima_user_DllExport MyUnion( + const MyUnion& x) + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + octet_value_() = x.m_octet_value; + break; + + case 0x00000002: + long_value_() = x.m_long_value; + break; + + case 0x00000003: + string_value_() = x.m_string_value; + break; + + } + } + + /*! + * @brief Move constructor. + * @param x Reference to the object MyUnion that will be copied. + */ + eProsima_user_DllExport MyUnion( + MyUnion&& x) noexcept + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + octet_value_() = std::move(x.m_octet_value); + break; + + case 0x00000002: + long_value_() = std::move(x.m_long_value); + break; + + case 0x00000003: + string_value_() = std::move(x.m_string_value); + break; + + } + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object MyUnion that will be copied. + */ + eProsima_user_DllExport MyUnion& operator =( + const MyUnion& x) + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + octet_value_() = x.m_octet_value; + break; + + case 0x00000002: + long_value_() = x.m_long_value; + break; + + case 0x00000003: + string_value_() = x.m_string_value; + break; + + } + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object MyUnion that will be copied. + */ + eProsima_user_DllExport MyUnion& operator =( + MyUnion&& x) noexcept + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + octet_value_() = std::move(x.m_octet_value); + break; + + case 0x00000002: + long_value_() = std::move(x.m_long_value); + break; + + case 0x00000003: + string_value_() = std::move(x.m_string_value); + break; + + } + + return *this; + } + + /*! + * @brief Comparison operator. + * @param x MyUnion object to compare. + */ + eProsima_user_DllExport bool operator ==( + const MyUnion& x) const + { + bool ret_value {false}; + + if (m__d == x.m__d && + selected_member_ == x.selected_member_) + { + switch (selected_member_) + { + case 0x00000001: + ret_value = (m_octet_value == x.m_octet_value); + break; + + case 0x00000002: + ret_value = (m_long_value == x.m_long_value); + break; + + case 0x00000003: + ret_value = (m_string_value == x.m_string_value); + break; + + } + } + + return ret_value; + } + + /*! + * @brief Comparison operator. + * @param x MyUnion object to compare. + */ + eProsima_user_DllExport bool operator !=( + const MyUnion& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets the discriminator value. + * @param __d New value for the discriminator. + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. + */ + eProsima_user_DllExport void _d( + int32_t __d) + { + bool valid_discriminator = false; + + switch (__d) + { + case 1: + if (0x00000001 == selected_member_) + { + valid_discriminator = true; + } + break; + + case 2: + if (0x00000002 == selected_member_) + { + valid_discriminator = true; + } + break; + + case 3: + if (0x00000003 == selected_member_) + { + valid_discriminator = true; + } + break; + + } + + if (!valid_discriminator) + { + throw eprosima::fastcdr::exception::BadParamException("Discriminator doesn't correspond with the selected union member"); + } + + m__d = __d; + } + + /*! + * @brief This function returns the value of the discriminator. + * @return Value of the discriminator + */ + eProsima_user_DllExport int32_t _d() const + { + return m__d; + } + + /*! + * @brief This function sets a value in member octet_value + * @param _octet_value New value for member octet_value + */ + eProsima_user_DllExport void octet_value( + uint8_t _octet_value) + { + octet_value_() = _octet_value; + m__d = 1; + } + + /*! + * @brief This function returns the value of member octet_value + * @return Value of member octet_value + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport uint8_t octet_value() const + { + if (0x00000001 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_octet_value; + } + + /*! + * @brief This function returns a reference to member octet_value + * @return Reference to member octet_value + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport uint8_t& octet_value() + { + if (0x00000001 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_octet_value; + } + + + /*! + * @brief This function sets a value in member long_value + * @param _long_value New value for member long_value + */ + eProsima_user_DllExport void long_value( + int32_t _long_value) + { + long_value_() = _long_value; + m__d = 2; + } + + /*! + * @brief This function returns the value of member long_value + * @return Value of member long_value + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport int32_t long_value() const + { + if (0x00000002 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_long_value; + } + + /*! + * @brief This function returns a reference to member long_value + * @return Reference to member long_value + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport int32_t& long_value() + { + if (0x00000002 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_long_value; + } + + + /*! + * @brief This function copies the value in member string_value + * @param _string_value New value to be copied in member string_value + */ + eProsima_user_DllExport void string_value( + const std::string& _string_value) + { + string_value_() = _string_value; + m__d = 3; + } + + /*! + * @brief This function moves the value in member string_value + * @param _string_value New value to be moved in member string_value + */ + eProsima_user_DllExport void string_value( + std::string&& _string_value) + { + string_value_() = _string_value; + m__d = 3; + } + + /*! + * @brief This function returns a constant reference to member string_value + * @return Constant reference to member string_value + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const std::string& string_value() const + { + if (0x00000003 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_string_value; + } + + /*! + * @brief This function returns a reference to member string_value + * @return Reference to member string_value + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport std::string& string_value() + { + if (0x00000003 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_string_value; + } + + + void _default() + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x0FFFFFFFu; + } + + +private: + + uint8_t& octet_value_() + { + if (0x00000001 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000001; + member_destructor_ = nullptr; + m_octet_value = {0}; + ; + } + + return m_octet_value; + } + + int32_t& long_value_() + { + if (0x00000002 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000002; + member_destructor_ = nullptr; + m_long_value = {0}; + ; + } + + return m_long_value; + } + + std::string& string_value_() + { + if (0x00000003 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000003; + member_destructor_ = [&]() {m_string_value.~basic_string();}; + new(&m_string_value) std::string(); + ; + } + + return m_string_value; + } + + + int32_t m__d {0}; + + union + { + uint8_t m_octet_value; + int32_t m_long_value; + std::string m_string_value; + }; + + uint32_t selected_member_ {0x0FFFFFFFu}; + + std::function member_destructor_; +}; +/*! + * @brief This class represents the structure union_struct defined by the user in the IDL file. + * @ingroup union_struct + */ +class union_struct +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport union_struct() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~union_struct() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object union_struct that will be copied. + */ + eProsima_user_DllExport union_struct( + const union_struct& x) + { + m_index = x.m_index; + + m_union_value = x.m_union_value; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object union_struct that will be copied. + */ + eProsima_user_DllExport union_struct( + union_struct&& x) noexcept + { + m_index = x.m_index; + m_union_value = std::move(x.m_union_value); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object union_struct that will be copied. + */ + eProsima_user_DllExport union_struct& operator =( + const union_struct& x) + { + + m_index = x.m_index; + + m_union_value = x.m_union_value; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object union_struct that will be copied. + */ + eProsima_user_DllExport union_struct& operator =( + union_struct&& x) noexcept + { + + m_index = x.m_index; + m_union_value = std::move(x.m_union_value); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x union_struct object to compare. + */ + eProsima_user_DllExport bool operator ==( + const union_struct& x) const + { + return (m_index == x.m_index && + m_union_value == x.m_union_value); + } + + /*! + * @brief Comparison operator. + * @param x union_struct object to compare. + */ + eProsima_user_DllExport bool operator !=( + const union_struct& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + eProsima_user_DllExport void index( + uint32_t _index) + { + m_index = _index; + } + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } + + + /*! + * @brief This function copies the value in member union_value + * @param _union_value New value to be copied in member union_value + */ + eProsima_user_DllExport void union_value( + const MyUnion& _union_value) + { + m_union_value = _union_value; + } + + /*! + * @brief This function moves the value in member union_value + * @param _union_value New value to be moved in member union_value + */ + eProsima_user_DllExport void union_value( + MyUnion&& _union_value) + { + m_union_value = std::move(_union_value); + } + + /*! + * @brief This function returns a constant reference to member union_value + * @return Constant reference to member union_value + */ + eProsima_user_DllExport const MyUnion& union_value() const + { + return m_union_value; + } + + /*! + * @brief This function returns a reference to member union_value + * @return Reference to member union_value + */ + eProsima_user_DllExport MyUnion& union_value() + { + return m_union_value; + } + + + +private: + + uint32_t m_index{0}; + MyUnion m_union_value; + +}; + +#endif // _FAST_DDS_GENERATED_UNION_STRUCT_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp similarity index 97% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structCdrAux.hpp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp index 16d39d64..19fe3c1b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp @@ -22,7 +22,7 @@ #ifndef _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_HPP_ #define _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_HPP_ -#include "union_struct.h" +#include "union_struct.hpp" constexpr uint32_t union_struct_max_cdr_typesize {276UL}; constexpr uint32_t union_struct_max_key_cdr_typesize {0UL}; @@ -35,12 +35,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const union_struct& data); diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp similarity index 72% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structCdrAux.ipp rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp index e5c87d0b..3472d9e6 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -56,18 +54,18 @@ eProsima_user_DllExport size_t calculate_serialized_size( switch (data._d()) { - case 1: - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + case 1: + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), data.octet_value(), current_alignment); break; - case 2: - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + case 2: + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), data.long_value(), current_alignment); break; - case 3: - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), + case 3: + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), data.string_value(), current_alignment); break; @@ -97,15 +95,15 @@ eProsima_user_DllExport void serialize( switch (data._d()) { case 1: - scdr << eprosima::fastcdr::MemberId(0) << data.octet_value(); + scdr << eprosima::fastcdr::MemberId(1) << data.octet_value(); break; case 2: - scdr << eprosima::fastcdr::MemberId(1) << data.long_value(); + scdr << eprosima::fastcdr::MemberId(2) << data.long_value(); break; case 3: - scdr << eprosima::fastcdr::MemberId(2) << data.string_value(); + scdr << eprosima::fastcdr::MemberId(3) << data.string_value(); break; default: @@ -126,38 +124,67 @@ eProsima_user_DllExport void deserialize( [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { bool ret_value = true; - switch (mid.id) + if (0 == mid.id) { - case 0: - dcdr >> data._d(); - break; - default: - switch (data._d()) - { - case 1: - dcdr >> data.octet_value(); - break; - - case 2: - dcdr >> data.long_value(); - break; - - case 3: - dcdr >> data.string_value(); - break; - - default: - break; - } - ret_value = false; - break; + int32_t discriminator; + dcdr >> discriminator; + + switch (discriminator) + { + case 1: + { + uint8_t octet_value_value{0}; + data.octet_value(std::move(octet_value_value)); + data._d(discriminator); + break; + } + + case 2: + { + int32_t long_value_value{0}; + data.long_value(std::move(long_value_value)); + data._d(discriminator); + break; + } + + case 3: + { + std::string string_value_value; + data.string_value(std::move(string_value_value)); + data._d(discriminator); + break; + } + + default: + data._default(); + break; + } + } + else + { + switch (data._d()) + { + case 1: + dcdr >> data.octet_value(); + break; + + case 2: + dcdr >> data.long_value(); + break; + + case 3: + dcdr >> data.string_value(); + break; + + default: + break; + } + ret_value = false; } return ret_value; }); } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx similarity index 96% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structPubSubTypes.cxx rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx index 35732fdd..00740e35 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx @@ -19,22 +19,18 @@ * This file was generated by the tool fastddsgen. */ +#include "union_structPubSubTypes.h" +#include #include -#include "union_structPubSubTypes.h" #include "union_structCdrAux.hpp" +#include "union_structTypeObjectSupport.hpp" using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - - - - - union_structPubSubType::union_structPubSubType() { setName("union_struct"); @@ -222,3 +218,12 @@ bool union_structPubSubType::getKey( } return true; } + +void union_structPubSubType::register_type_object_representation() const +{ + register_union_struct_type_objects(); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "union_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h similarity index 94% rename from ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h index ca9f95d0..4771c51d 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h @@ -27,9 +27,9 @@ #include #include #include -#include +#include -#include "union_struct.h" +#include "union_struct.hpp" #if !defined(GEN_API_VER) || (GEN_API_VER != 2) @@ -38,12 +38,6 @@ #endif // GEN_API_VER - - - - - - /*! * @brief This class represents the TopicDataType of the type union_struct defined by the user in the IDL file. * @ingroup union_struct @@ -94,6 +88,9 @@ class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport void deleteData( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() const override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -133,3 +130,4 @@ class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType }; #endif // _FAST_DDS_GENERATED_UNION_STRUCT_PUBSUBTYPES_H_ + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx new file mode 100644 index 00000000..ee022630 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx @@ -0,0 +1,815 @@ +// 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 union_structTypeObjectSupport.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. + */ + +#include "union_structTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "union_struct.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +void register_union_struct_type_objects() +{ + static std::once_flag once_flag; + std::call_once(once_flag, []() + { + register_MyUnion_type_identifier(); + + register_union_struct_type_identifier(); + + }); +} + +void register_MyUnion_type_identifier() +{ + { + ReturnCode_t return_code_MyUnion; + TypeIdentifierPair type_ids_MyUnion; + UnionTypeFlag union_flags_MyUnion = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + QualifiedTypeName type_name_MyUnion = "MyUnion"; + eprosima::fastcdr::optional type_ann_builtin_MyUnion; + eprosima::fastcdr::optional ann_custom_MyUnion; + CompleteTypeDetail detail_MyUnion = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MyUnion, ann_custom_MyUnion, type_name_MyUnion.to_string()); + CompleteUnionHeader header_MyUnion = TypeObjectUtils::build_complete_union_header(detail_MyUnion); + UnionDiscriminatorFlag member_flags_MyUnion = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false); + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union discriminator TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + CommonDiscriminatorMember common_MyUnion; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d()) + { + common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d()) + { + common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MyUnion discriminator TypeIdentifier inconsistent."); + return; + } + type_ann_builtin_MyUnion.reset(); + ann_custom_MyUnion.reset(); + CompleteDiscriminatorMember discriminator_MyUnion = TypeObjectUtils::build_complete_discriminator_member(common_MyUnion, + type_ann_builtin_MyUnion, ann_custom_MyUnion); + CompleteUnionMemberSeq member_seq_MyUnion; + { + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "octet_value Union member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + UnionMemberFlag member_flags_octet_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false); + UnionCaseLabelSeq label_seq_octet_value; + TypeObjectUtils::add_union_case_label(label_seq_octet_value, static_cast(1)); + CommonUnionMember common_octet_value; + MemberId member_id_octet_value = 0x00000001; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier1(), + label_seq_octet_value); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier2(), + label_seq_octet_value); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union octet_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_octet_value = "octet_value"; + eprosima::fastcdr::optional member_ann_builtin_octet_value; + ann_custom_MyUnion.reset(); + CompleteMemberDetail detail_octet_value = TypeObjectUtils::build_complete_member_detail(name_octet_value, member_ann_builtin_octet_value, ann_custom_MyUnion); + CompleteUnionMember member_octet_value = TypeObjectUtils::build_complete_union_member(common_octet_value, detail_octet_value); + TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_octet_value); + } + { + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "long_value Union member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + UnionMemberFlag member_flags_long_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false); + UnionCaseLabelSeq label_seq_long_value; + TypeObjectUtils::add_union_case_label(label_seq_long_value, static_cast(2)); + CommonUnionMember common_long_value; + MemberId member_id_long_value = 0x00000002; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier1(), + label_seq_long_value); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier2(), + label_seq_long_value); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union long_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_long_value = "long_value"; + eprosima::fastcdr::optional member_ann_builtin_long_value; + ann_custom_MyUnion.reset(); + CompleteMemberDetail detail_long_value = TypeObjectUtils::build_complete_member_detail(name_long_value, member_ann_builtin_long_value, ann_custom_MyUnion); + CompleteUnionMember member_long_value = TypeObjectUtils::build_complete_union_member(common_long_value, detail_long_value); + TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_long_value); + } + { + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_MyUnion); + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + UnionMemberFlag member_flags_string_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false); + UnionCaseLabelSeq label_seq_string_value; + TypeObjectUtils::add_union_case_label(label_seq_string_value, static_cast(3)); + CommonUnionMember common_string_value; + MemberId member_id_string_value = 0x00000003; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier1(), + label_seq_string_value); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier2(), + label_seq_string_value); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union string_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_string_value = "string_value"; + eprosima::fastcdr::optional member_ann_builtin_string_value; + ann_custom_MyUnion.reset(); + CompleteMemberDetail detail_string_value = TypeObjectUtils::build_complete_member_detail(name_string_value, member_ann_builtin_string_value, ann_custom_MyUnion); + CompleteUnionMember member_string_value = TypeObjectUtils::build_complete_union_member(common_string_value, detail_string_value); + TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_string_value); + } + CompleteUnionType union_type_MyUnion = TypeObjectUtils::build_complete_union_type(union_flags_MyUnion, header_MyUnion, discriminator_MyUnion, + member_seq_MyUnion); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_union_type_object(union_type_MyUnion, type_name_MyUnion.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MyUnion already registered in TypeObjectRegistry for a different type."); + } + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MyUnion", type_ids_MyUnion); + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MyUnion: Given Union TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} +void register_union_struct_type_identifier() +{ + { + StructTypeFlag struct_flags_union_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + ReturnCode_t return_code_union_struct; + TypeIdentifierPair type_ids_union_struct; + QualifiedTypeName type_name_union_struct = "union_struct"; + eprosima::fastcdr::optional type_ann_builtin_union_struct; + eprosima::fastcdr::optional ann_custom_union_struct; + CompleteTypeDetail detail_union_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_union_struct, ann_custom_union_struct, type_name_union_struct.to_string()); + CompleteStructHeader header_union_struct; + header_union_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_union_struct); + CompleteStructMemberSeq member_seq_union_struct; + { + return_code_union_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_union_struct); + + if (return_code_union_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_index; + MemberId member_id_index = 0x00000000; + if (EK_COMPLETE == type_ids_union_struct.type_identifier1()._d() || TK_NONE == type_ids_union_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_union_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_union_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_union_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_union_struct.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_union_struct); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_union_struct, member_index); + } + { + return_code_union_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MyUnion", type_ids_union_struct); + + if (return_code_union_struct != eprosima::fastdds::dds::RETCODE_OK) + { + { + ReturnCode_t return_code_MyUnion; + TypeIdentifierPair type_ids_MyUnion; + UnionTypeFlag union_flags_MyUnion = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + false, false); + QualifiedTypeName type_name_MyUnion = "MyUnion"; + eprosima::fastcdr::optional type_ann_builtin_MyUnion; + eprosima::fastcdr::optional ann_custom_MyUnion; + CompleteTypeDetail detail_MyUnion = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MyUnion, ann_custom_MyUnion, type_name_MyUnion.to_string()); + CompleteUnionHeader header_MyUnion = TypeObjectUtils::build_complete_union_header(detail_MyUnion); + UnionDiscriminatorFlag member_flags_MyUnion = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false); + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union discriminator TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + CommonDiscriminatorMember common_MyUnion; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d()) + { + common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d()) + { + common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MyUnion discriminator TypeIdentifier inconsistent."); + return; + } + type_ann_builtin_MyUnion.reset(); + ann_custom_MyUnion.reset(); + CompleteDiscriminatorMember discriminator_MyUnion = TypeObjectUtils::build_complete_discriminator_member(common_MyUnion, + type_ann_builtin_MyUnion, ann_custom_MyUnion); + CompleteUnionMemberSeq member_seq_MyUnion; + { + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "octet_value Union member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + UnionMemberFlag member_flags_octet_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false); + UnionCaseLabelSeq label_seq_octet_value; + TypeObjectUtils::add_union_case_label(label_seq_octet_value, static_cast(1)); + CommonUnionMember common_octet_value; + MemberId member_id_octet_value = 0x00000001; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier1(), + label_seq_octet_value); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier2(), + label_seq_octet_value); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union octet_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_octet_value = "octet_value"; + eprosima::fastcdr::optional member_ann_builtin_octet_value; + ann_custom_MyUnion.reset(); + CompleteMemberDetail detail_octet_value = TypeObjectUtils::build_complete_member_detail(name_octet_value, member_ann_builtin_octet_value, ann_custom_MyUnion); + CompleteUnionMember member_octet_value = TypeObjectUtils::build_complete_union_member(common_octet_value, detail_octet_value); + TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_octet_value); + } + { + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "long_value Union member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + UnionMemberFlag member_flags_long_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false); + UnionCaseLabelSeq label_seq_long_value; + TypeObjectUtils::add_union_case_label(label_seq_long_value, static_cast(2)); + CommonUnionMember common_long_value; + MemberId member_id_long_value = 0x00000002; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier1(), + label_seq_long_value); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier2(), + label_seq_long_value); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union long_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_long_value = "long_value"; + eprosima::fastcdr::optional member_ann_builtin_long_value; + ann_custom_MyUnion.reset(); + CompleteMemberDetail detail_long_value = TypeObjectUtils::build_complete_member_detail(name_long_value, member_ann_builtin_long_value, ann_custom_MyUnion); + CompleteUnionMember member_long_value = TypeObjectUtils::build_complete_union_member(common_long_value, detail_long_value); + TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_long_value); + } + { + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_MyUnion); + + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); + if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") + { + LBound bound = 255; + StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, + "anonymous_string_unbounded")) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Unknown String kind."); + return; + } + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_MyUnion); + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + UnionMemberFlag member_flags_string_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false); + UnionCaseLabelSeq label_seq_string_value; + TypeObjectUtils::add_union_case_label(label_seq_string_value, static_cast(3)); + CommonUnionMember common_string_value; + MemberId member_id_string_value = 0x00000003; + if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier1(), + label_seq_string_value); + } + else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && + EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && + (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier2(), + label_seq_string_value); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union string_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_string_value = "string_value"; + eprosima::fastcdr::optional member_ann_builtin_string_value; + ann_custom_MyUnion.reset(); + CompleteMemberDetail detail_string_value = TypeObjectUtils::build_complete_member_detail(name_string_value, member_ann_builtin_string_value, ann_custom_MyUnion); + CompleteUnionMember member_string_value = TypeObjectUtils::build_complete_union_member(common_string_value, detail_string_value); + TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_string_value); + } + CompleteUnionType union_type_MyUnion = TypeObjectUtils::build_complete_union_type(union_flags_MyUnion, header_MyUnion, discriminator_MyUnion, + member_seq_MyUnion); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_union_type_object(union_type_MyUnion, type_name_MyUnion.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MyUnion already registered in TypeObjectRegistry for a different type."); + } + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MyUnion", type_ids_MyUnion); + if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "MyUnion: Given Union TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } + } + StructMemberFlag member_flags_union_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + false, false, false, false); + CommonStructMember common_union_value; + MemberId member_id_union_value = 0x00000001; + if (EK_COMPLETE == type_ids_union_struct.type_identifier1()._d() || TK_NONE == type_ids_union_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier1()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier1()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + { + common_union_value = TypeObjectUtils::build_common_struct_member(member_id_union_value, member_flags_union_value, type_ids_union_struct.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_union_struct.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier2()._d() && + EK_COMPLETE == type_ids_union_struct.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier2()._d() && + (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + { + common_union_value = TypeObjectUtils::build_common_struct_member(member_id_union_value, member_flags_union_value, type_ids_union_struct.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Structure union_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_union_value = "union_value"; + eprosima::fastcdr::optional member_ann_builtin_union_value; + ann_custom_union_struct.reset(); + CompleteMemberDetail detail_union_value = TypeObjectUtils::build_complete_member_detail(name_union_value, member_ann_builtin_union_value, ann_custom_union_struct); + CompleteStructMember member_union_value = TypeObjectUtils::build_complete_struct_member(common_union_value, detail_union_value); + TypeObjectUtils::add_complete_struct_member(member_seq_union_struct, member_union_value); + } + CompleteStructType struct_type_union_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_union_struct, header_union_struct, member_seq_union_struct); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_union_struct, type_name_union_struct.to_string())) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "union_struct already registered in TypeObjectRegistry for a different type."); + } + return_code_union_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "union_struct", type_ids_union_struct); + if (return_code_union_struct != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "union_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp new file mode 100644 index 00000000..7db11667 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp @@ -0,0 +1,61 @@ +// 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 union_structTypeObjectSupport.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. + */ + +#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#define _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ + + +#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 + +/** + * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. + */ +eProsima_user_DllExport void register_union_struct_type_objects(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register MyUnion related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_MyUnion_type_identifier(); +/** + * @brief Register union_struct related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + */ +eProsima_user_DllExport void register_union_struct_type_identifier(); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/all_types.hpp deleted file mode 100644 index 65fa0566..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/all_types.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2022 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 all_types.hpp - */ - -/* - * USEFUL COMMAND - * - * for TYPE in hello_world numeric_array char_sequence basic_struct basic_array_struct float_bounded_sequence arrays_and_sequences complex_nested_arrays; do ${FASTDDSGEN_WS}/scripts/fastddsgen -replace -d ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/type_objects/ -typeobject -cs ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/idls/${TYPE}.idl; done - */ - -#pragma once - -#include -#include -#include - -#include -#include -#include - -#include "type_objects/hello_worldTypeObject.h" -#include "type_objects/numeric_arrayTypeObject.h" -#include "type_objects/char_sequenceTypeObject.h" -#include "type_objects/basic_structTypeObject.h" -#include "type_objects/basic_array_structTypeObject.h" -#include "type_objects/float_bounded_sequenceTypeObject.h" -#include "type_objects/arrays_and_sequencesTypeObject.h" -#include "type_objects/complex_nested_arraysTypeObject.h" -#include "type_objects/enum_structTypeObject.h" -#include "type_objects/union_structTypeObject.h" -#include "type_objects/map_structTypeObject.h" - -namespace test { - -ENUMERATION_BUILDER( - SupportedType, - hello_world, - numeric_array, - char_sequence, - basic_struct, - basic_array_struct, - float_bounded_sequence, - arrays_and_sequences, - complex_nested_arrays, - enum_struct, - union_struct, // NOTE: default case currently not supported in dynamic types - map_struct - ); - -eprosima::fastrtps::types::DynamicType_ptr get_dynamic_type( - SupportedType type) -{ - registerhello_worldTypes(); - registernumeric_arrayTypes(); - registerchar_sequenceTypes(); - registerbasic_structTypes(); - registerbasic_array_structTypes(); - registerfloat_bounded_sequenceTypes(); - registerarrays_and_sequencesTypes(); - registercomplex_nested_arraysTypes(); - registerenum_structTypes(); - registerunion_structTypes(); - registermap_structTypes(); - - auto type_name = to_string(type); - - auto type_obj_factory = eprosima::fastrtps::types::TypeObjectFactory::get_instance(); - auto type_id = type_obj_factory->get_type_identifier(type_name, true); - if (type_id == nullptr) - { - throw eprosima::utils::InconsistencyException("Not Type Id"); - } - - auto type_obj = type_obj_factory->get_type_object(type_id); - if (type_obj == nullptr) - { - throw eprosima::utils::InconsistencyException("Not Type Object"); - } - - return type_obj_factory->build_dynamic_type(type_name, type_id, type_obj); -} - -} /* namespace test */ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.cxx deleted file mode 100644 index da1b66da..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.cxx +++ /dev/null @@ -1,520 +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 arrays_and_sequences.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "arrays_and_sequences.h" -#include "arrays_and_sequencesTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -AnInternalObject::AnInternalObject() -{ - // m_x com.eprosima.idl.parser.typecode.PrimitiveTypeCode@47ef968d - m_x = 0.0; - // m_positive com.eprosima.idl.parser.typecode.PrimitiveTypeCode@23e028a9 - m_positive = false; - - // Just to register all known types - registerarrays_and_sequencesTypes(); -} - -AnInternalObject::~AnInternalObject() -{ - - -} - -AnInternalObject::AnInternalObject( - const AnInternalObject& x) -{ - m_x = x.m_x; - m_positive = x.m_positive; -} - -AnInternalObject::AnInternalObject( - AnInternalObject&& x) noexcept -{ - m_x = x.m_x; - m_positive = x.m_positive; -} - -AnInternalObject& AnInternalObject::operator =( - const AnInternalObject& x) -{ - - m_x = x.m_x; - m_positive = x.m_positive; - - return *this; -} - -AnInternalObject& AnInternalObject::operator =( - AnInternalObject&& x) noexcept -{ - - m_x = x.m_x; - m_positive = x.m_positive; - - return *this; -} - -bool AnInternalObject::operator ==( - const AnInternalObject& x) const -{ - - return (m_x == x.m_x && m_positive == x.m_positive); -} - -bool AnInternalObject::operator !=( - const AnInternalObject& x) const -{ - return !(*this == x); -} - -size_t AnInternalObject::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - -size_t AnInternalObject::getCdrSerializedSize( - const AnInternalObject& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - -void AnInternalObject::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_x; - scdr << m_positive; - -} - -void AnInternalObject::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_x; - dcdr >> m_positive; -} - -/*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ -void AnInternalObject::x( - float _x) -{ - m_x = _x; -} - -/*! - * @brief This function returns the value of member x - * @return Value of member x - */ -float AnInternalObject::x() const -{ - return m_x; -} - -/*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ -float& AnInternalObject::x() -{ - return m_x; -} - -/*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ -void AnInternalObject::positive( - bool _positive) -{ - m_positive = _positive; -} - -/*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ -bool AnInternalObject::positive() const -{ - return m_positive; -} - -/*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ -bool& AnInternalObject::positive() -{ - return m_positive; -} - - -size_t AnInternalObject::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - return current_align; -} - -bool AnInternalObject::isKeyDefined() -{ - return false; -} - -void AnInternalObject::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} - -arrays_and_sequences::arrays_and_sequences() -{ - // m_unlimited_vector com.eprosima.idl.parser.typecode.SequenceTypeCode@42eca56e - - // m_limited_vector com.eprosima.idl.parser.typecode.SequenceTypeCode@52f759d7 - - // m_limited_array com.eprosima.idl.parser.typecode.ArrayTypeCode@7cbd213e - - - // Just to register all known types - registerarrays_and_sequencesTypes(); -} - -arrays_and_sequences::~arrays_and_sequences() -{ - - - -} - -arrays_and_sequences::arrays_and_sequences( - const arrays_and_sequences& x) -{ - m_unlimited_vector = x.m_unlimited_vector; - m_limited_vector = x.m_limited_vector; - m_limited_array = x.m_limited_array; -} - -arrays_and_sequences::arrays_and_sequences( - arrays_and_sequences&& x) noexcept -{ - m_unlimited_vector = std::move(x.m_unlimited_vector); - m_limited_vector = std::move(x.m_limited_vector); - m_limited_array = std::move(x.m_limited_array); -} - -arrays_and_sequences& arrays_and_sequences::operator =( - const arrays_and_sequences& x) -{ - - m_unlimited_vector = x.m_unlimited_vector; - m_limited_vector = x.m_limited_vector; - m_limited_array = x.m_limited_array; - - return *this; -} - -arrays_and_sequences& arrays_and_sequences::operator =( - arrays_and_sequences&& x) noexcept -{ - - m_unlimited_vector = std::move(x.m_unlimited_vector); - m_limited_vector = std::move(x.m_limited_vector); - m_limited_array = std::move(x.m_limited_array); - - return *this; -} - -bool arrays_and_sequences::operator ==( - const arrays_and_sequences& x) const -{ - - return (m_unlimited_vector == x.m_unlimited_vector && m_limited_vector == x.m_limited_vector && m_limited_array == x.m_limited_array); -} - -bool arrays_and_sequences::operator !=( - const arrays_and_sequences& x) const -{ - return !(*this == x); -} - -size_t arrays_and_sequences::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < 100; ++a) - { - current_alignment += AnInternalObject::getMaxCdrSerializedSize(current_alignment);} - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < 10; ++a) - { - current_alignment += AnInternalObject::getMaxCdrSerializedSize(current_alignment);} - - - for(size_t a = 0; a < (10); ++a) - { - current_alignment += AnInternalObject::getMaxCdrSerializedSize(current_alignment);} - - return current_alignment - initial_alignment; -} - -size_t arrays_and_sequences::getCdrSerializedSize( - const arrays_and_sequences& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.unlimited_vector().size(); ++a) - { - current_alignment += AnInternalObject::getCdrSerializedSize(data.unlimited_vector().at(a), current_alignment);} - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.limited_vector().size(); ++a) - { - current_alignment += AnInternalObject::getCdrSerializedSize(data.limited_vector().at(a), current_alignment);} - - - for(size_t a = 0; a < data.limited_array().size(); ++a) - { - current_alignment += AnInternalObject::getCdrSerializedSize(data.limited_array().at(a), current_alignment); - } - - return current_alignment - initial_alignment; -} - -void arrays_and_sequences::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_unlimited_vector; - scdr << m_limited_vector; - scdr << m_limited_array; - - -} - -void arrays_and_sequences::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_unlimited_vector; - dcdr >> m_limited_vector; - dcdr >> m_limited_array; - -} - -/*! - * @brief This function copies the value in member unlimited_vector - * @param _unlimited_vector New value to be copied in member unlimited_vector - */ -void arrays_and_sequences::unlimited_vector( - const std::vector& _unlimited_vector) -{ - m_unlimited_vector = _unlimited_vector; -} - -/*! - * @brief This function moves the value in member unlimited_vector - * @param _unlimited_vector New value to be moved in member unlimited_vector - */ -void arrays_and_sequences::unlimited_vector( - std::vector&& _unlimited_vector) -{ - m_unlimited_vector = std::move(_unlimited_vector); -} - -/*! - * @brief This function returns a constant reference to member unlimited_vector - * @return Constant reference to member unlimited_vector - */ -const std::vector& arrays_and_sequences::unlimited_vector() const -{ - return m_unlimited_vector; -} - -/*! - * @brief This function returns a reference to member unlimited_vector - * @return Reference to member unlimited_vector - */ -std::vector& arrays_and_sequences::unlimited_vector() -{ - return m_unlimited_vector; -} -/*! - * @brief This function copies the value in member limited_vector - * @param _limited_vector New value to be copied in member limited_vector - */ -void arrays_and_sequences::limited_vector( - const std::vector& _limited_vector) -{ - m_limited_vector = _limited_vector; -} - -/*! - * @brief This function moves the value in member limited_vector - * @param _limited_vector New value to be moved in member limited_vector - */ -void arrays_and_sequences::limited_vector( - std::vector&& _limited_vector) -{ - m_limited_vector = std::move(_limited_vector); -} - -/*! - * @brief This function returns a constant reference to member limited_vector - * @return Constant reference to member limited_vector - */ -const std::vector& arrays_and_sequences::limited_vector() const -{ - return m_limited_vector; -} - -/*! - * @brief This function returns a reference to member limited_vector - * @return Reference to member limited_vector - */ -std::vector& arrays_and_sequences::limited_vector() -{ - return m_limited_vector; -} -/*! - * @brief This function copies the value in member limited_array - * @param _limited_array New value to be copied in member limited_array - */ -void arrays_and_sequences::limited_array( - const std::array& _limited_array) -{ - m_limited_array = _limited_array; -} - -/*! - * @brief This function moves the value in member limited_array - * @param _limited_array New value to be moved in member limited_array - */ -void arrays_and_sequences::limited_array( - std::array&& _limited_array) -{ - m_limited_array = std::move(_limited_array); -} - -/*! - * @brief This function returns a constant reference to member limited_array - * @return Constant reference to member limited_array - */ -const std::array& arrays_and_sequences::limited_array() const -{ - return m_limited_array; -} - -/*! - * @brief This function returns a reference to member limited_array - * @return Reference to member limited_array - */ -std::array& arrays_and_sequences::limited_array() -{ - return m_limited_array; -} - -size_t arrays_and_sequences::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - - return current_align; -} - -bool arrays_and_sequences::isKeyDefined() -{ - return false; -} - -void arrays_and_sequences::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.h deleted file mode 100644 index 32b71e9c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequences.h +++ /dev/null @@ -1,427 +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 arrays_and_sequences.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(arrays_and_sequences_SOURCE) -#define arrays_and_sequences_DllAPI __declspec( dllexport ) -#else -#define arrays_and_sequences_DllAPI __declspec( dllimport ) -#endif // arrays_and_sequences_SOURCE -#else -#define arrays_and_sequences_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define arrays_and_sequences_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure AnInternalObject defined by the user in the IDL file. - * @ingroup ARRAYS_AND_SEQUENCES - */ -class AnInternalObject -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport AnInternalObject(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~AnInternalObject(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject( - const AnInternalObject& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject( - AnInternalObject&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject& operator =( - const AnInternalObject& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject& operator =( - AnInternalObject&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x AnInternalObject object to compare. - */ - eProsima_user_DllExport bool operator ==( - const AnInternalObject& x) const; - - /*! - * @brief Comparison operator. - * @param x AnInternalObject object to compare. - */ - eProsima_user_DllExport bool operator !=( - const AnInternalObject& x) const; - - /*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ - eProsima_user_DllExport void x( - float _x); - - /*! - * @brief This function returns the value of member x - * @return Value of member x - */ - eProsima_user_DllExport float x() const; - - /*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ - eProsima_user_DllExport float& x(); - - /*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ - eProsima_user_DllExport void positive( - bool _positive); - - /*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ - eProsima_user_DllExport bool positive() const; - - /*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ - eProsima_user_DllExport bool& positive(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const AnInternalObject& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - float m_x; - bool m_positive; -}; -/*! - * @brief This class represents the structure arrays_and_sequences defined by the user in the IDL file. - * @ingroup ARRAYS_AND_SEQUENCES - */ -class arrays_and_sequences -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport arrays_and_sequences(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~arrays_and_sequences(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences( - const arrays_and_sequences& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences( - arrays_and_sequences&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences& operator =( - const arrays_and_sequences& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences& operator =( - arrays_and_sequences&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x arrays_and_sequences object to compare. - */ - eProsima_user_DllExport bool operator ==( - const arrays_and_sequences& x) const; - - /*! - * @brief Comparison operator. - * @param x arrays_and_sequences object to compare. - */ - eProsima_user_DllExport bool operator !=( - const arrays_and_sequences& x) const; - - /*! - * @brief This function copies the value in member unlimited_vector - * @param _unlimited_vector New value to be copied in member unlimited_vector - */ - eProsima_user_DllExport void unlimited_vector( - const std::vector& _unlimited_vector); - - /*! - * @brief This function moves the value in member unlimited_vector - * @param _unlimited_vector New value to be moved in member unlimited_vector - */ - eProsima_user_DllExport void unlimited_vector( - std::vector&& _unlimited_vector); - - /*! - * @brief This function returns a constant reference to member unlimited_vector - * @return Constant reference to member unlimited_vector - */ - eProsima_user_DllExport const std::vector& unlimited_vector() const; - - /*! - * @brief This function returns a reference to member unlimited_vector - * @return Reference to member unlimited_vector - */ - eProsima_user_DllExport std::vector& unlimited_vector(); - /*! - * @brief This function copies the value in member limited_vector - * @param _limited_vector New value to be copied in member limited_vector - */ - eProsima_user_DllExport void limited_vector( - const std::vector& _limited_vector); - - /*! - * @brief This function moves the value in member limited_vector - * @param _limited_vector New value to be moved in member limited_vector - */ - eProsima_user_DllExport void limited_vector( - std::vector&& _limited_vector); - - /*! - * @brief This function returns a constant reference to member limited_vector - * @return Constant reference to member limited_vector - */ - eProsima_user_DllExport const std::vector& limited_vector() const; - - /*! - * @brief This function returns a reference to member limited_vector - * @return Reference to member limited_vector - */ - eProsima_user_DllExport std::vector& limited_vector(); - /*! - * @brief This function copies the value in member limited_array - * @param _limited_array New value to be copied in member limited_array - */ - eProsima_user_DllExport void limited_array( - const std::array& _limited_array); - - /*! - * @brief This function moves the value in member limited_array - * @param _limited_array New value to be moved in member limited_array - */ - eProsima_user_DllExport void limited_array( - std::array&& _limited_array); - - /*! - * @brief This function returns a constant reference to member limited_array - * @return Constant reference to member limited_array - */ - eProsima_user_DllExport const std::array& limited_array() const; - - /*! - * @brief This function returns a reference to member limited_array - * @return Reference to member limited_array - */ - eProsima_user_DllExport std::array& limited_array(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const arrays_and_sequences& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::vector m_unlimited_vector; - std::vector m_limited_vector; - std::array m_limited_array; -}; - -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.cxx deleted file mode 100644 index 56d15be3..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.cxx +++ /dev/null @@ -1,309 +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 arrays_and_sequencesPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "arrays_and_sequencesPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -AnInternalObjectPubSubType::AnInternalObjectPubSubType() -{ - setName("AnInternalObject"); - auto type_size = AnInternalObject::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = AnInternalObject::isKeyDefined(); - size_t keyLength = AnInternalObject::getKeyMaxCdrSerializedSize() > 16 ? - AnInternalObject::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -AnInternalObjectPubSubType::~AnInternalObjectPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool AnInternalObjectPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - AnInternalObject* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool AnInternalObjectPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - AnInternalObject* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function AnInternalObjectPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* AnInternalObjectPubSubType::createData() -{ - return reinterpret_cast(new AnInternalObject()); -} - -void AnInternalObjectPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool AnInternalObjectPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - AnInternalObject* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - AnInternalObject::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || AnInternalObject::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -arrays_and_sequencesPubSubType::arrays_and_sequencesPubSubType() -{ - setName("arrays_and_sequences"); - auto type_size = arrays_and_sequences::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = arrays_and_sequences::isKeyDefined(); - size_t keyLength = arrays_and_sequences::getKeyMaxCdrSerializedSize() > 16 ? - arrays_and_sequences::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -arrays_and_sequencesPubSubType::~arrays_and_sequencesPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool arrays_and_sequencesPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - arrays_and_sequences* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool arrays_and_sequencesPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - arrays_and_sequences* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function arrays_and_sequencesPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* arrays_and_sequencesPubSubType::createData() -{ - return reinterpret_cast(new arrays_and_sequences()); -} - -void arrays_and_sequencesPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool arrays_and_sequencesPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - arrays_and_sequences* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - arrays_and_sequences::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || arrays_and_sequences::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.h deleted file mode 100644 index 0ef7d1b9..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesPubSubTypes.h +++ /dev/null @@ -1,165 +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 arrays_and_sequencesPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_PUBSUBTYPES_H_ - -#include -#include - -#include "arrays_and_sequences.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated arrays_and_sequences is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type AnInternalObject defined by the user in the IDL file. - * @ingroup ARRAYS_AND_SEQUENCES - */ -class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef AnInternalObject type; - - eProsima_user_DllExport AnInternalObjectPubSubType(); - - eProsima_user_DllExport virtual ~AnInternalObjectPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) AnInternalObject(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; -/*! - * @brief This class represents the TopicDataType of the type arrays_and_sequences defined by the user in the IDL file. - * @ingroup ARRAYS_AND_SEQUENCES - */ -class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef arrays_and_sequences type; - - eProsima_user_DllExport arrays_and_sequencesPubSubType(); - - eProsima_user_DllExport virtual ~arrays_and_sequencesPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.cxx deleted file mode 100644 index b6e19eaf..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.cxx +++ /dev/null @@ -1,487 +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 arrays_and_sequencesTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "arrays_and_sequences.h" -#include "arrays_and_sequencesTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerarrays_and_sequencesTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("AnInternalObject", GetAnInternalObjectIdentifier(true), - GetAnInternalObjectObject(true)); - factory->add_type_object("AnInternalObject", GetAnInternalObjectIdentifier(false), - GetAnInternalObjectObject(false)); - - factory->add_type_object("arrays_and_sequences", Getarrays_and_sequencesIdentifier(true), - Getarrays_and_sequencesObject(true)); - factory->add_type_object("arrays_and_sequences", Getarrays_and_sequencesIdentifier(false), - Getarrays_and_sequencesObject(false)); - -} - -const TypeIdentifier* GetAnInternalObjectIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("AnInternalObject", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetAnInternalObjectObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("AnInternalObject", complete); -} - -const TypeObject* GetAnInternalObjectObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteAnInternalObjectObject(); - } - //else - return GetMinimalAnInternalObjectObject(); -} - -const TypeObject* GetMinimalAnInternalObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_x; - mst_x.common().member_id(memberId++); - mst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_x.common().member_flags().IS_OPTIONAL(false); - mst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_x.common().member_flags().IS_KEY(false); - mst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("float", false)); - - MD5 x_hash("x"); - for(int i = 0; i < 4; ++i) - { - mst_x.detail().name_hash()[i] = x_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_x); - - MinimalStructMember mst_positive; - mst_positive.common().member_id(memberId++); - mst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_positive.common().member_flags().IS_OPTIONAL(false); - mst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_positive.common().member_flags().IS_KEY(false); - mst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - MD5 positive_hash("positive"); - for(int i = 0; i < 4; ++i) - { - mst_positive.detail().name_hash()[i] = positive_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_positive); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("AnInternalObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", false); -} - -const TypeObject* GetCompleteAnInternalObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_x; - cst_x.common().member_id(memberId++); - cst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_x.common().member_flags().IS_OPTIONAL(false); - cst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_x.common().member_flags().IS_KEY(false); - cst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("float", false)); - - cst_x.detail().name("x"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_x); - - CompleteStructMember cst_positive; - cst_positive.common().member_id(memberId++); - cst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_positive.common().member_flags().IS_OPTIONAL(false); - cst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_positive.common().member_flags().IS_KEY(false); - cst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - cst_positive.detail().name("positive"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_positive); - - - // Header - type_object->complete().struct_type().header().detail().type_name("AnInternalObject"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("AnInternalObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", true); -} - -const TypeIdentifier* Getarrays_and_sequencesIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("arrays_and_sequences", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getarrays_and_sequencesObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("arrays_and_sequences", complete); -} - -const TypeObject* Getarrays_and_sequencesObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletearrays_and_sequencesObject(); - } - //else - return GetMinimalarrays_and_sequencesObject(); -} - -const TypeObject* GetMinimalarrays_and_sequencesObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_unlimited_vector; - mst_unlimited_vector.common().member_id(memberId++); - mst_unlimited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_unlimited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_unlimited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_unlimited_vector.common().member_flags().IS_OPTIONAL(false); - mst_unlimited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_unlimited_vector.common().member_flags().IS_KEY(false); - mst_unlimited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_unlimited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 0, false)); - - - MD5 unlimited_vector_hash("unlimited_vector"); - for(int i = 0; i < 4; ++i) - { - mst_unlimited_vector.detail().name_hash()[i] = unlimited_vector_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_unlimited_vector); - - MinimalStructMember mst_limited_vector; - mst_limited_vector.common().member_id(memberId++); - mst_limited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_limited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_limited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_limited_vector.common().member_flags().IS_OPTIONAL(false); - mst_limited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_limited_vector.common().member_flags().IS_KEY(false); - mst_limited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_limited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 10, false)); - - - MD5 limited_vector_hash("limited_vector"); - for(int i = 0; i < 4; ++i) - { - mst_limited_vector.detail().name_hash()[i] = limited_vector_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_limited_vector); - - MinimalStructMember mst_limited_array; - mst_limited_array.common().member_id(memberId++); - mst_limited_array.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_limited_array.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_limited_array.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_limited_array.common().member_flags().IS_OPTIONAL(false); - mst_limited_array.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_limited_array.common().member_flags().IS_KEY(false); - mst_limited_array.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_limited_array.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("AnInternalObject", {10}, false)); - - - MD5 limited_array_hash("limited_array"); - for(int i = 0; i < 4; ++i) - { - mst_limited_array.detail().name_hash()[i] = limited_array_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_limited_array); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("arrays_and_sequences", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", false); -} - -const TypeObject* GetCompletearrays_and_sequencesObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_unlimited_vector; - cst_unlimited_vector.common().member_id(memberId++); - cst_unlimited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_unlimited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_unlimited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_unlimited_vector.common().member_flags().IS_OPTIONAL(false); - cst_unlimited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_unlimited_vector.common().member_flags().IS_KEY(false); - cst_unlimited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_unlimited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 0, true)); - - - cst_unlimited_vector.detail().name("unlimited_vector"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_unlimited_vector); - - CompleteStructMember cst_limited_vector; - cst_limited_vector.common().member_id(memberId++); - cst_limited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_limited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_limited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_limited_vector.common().member_flags().IS_OPTIONAL(false); - cst_limited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_limited_vector.common().member_flags().IS_KEY(false); - cst_limited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_limited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 10, true)); - - - cst_limited_vector.detail().name("limited_vector"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_limited_vector); - - CompleteStructMember cst_limited_array; - cst_limited_array.common().member_id(memberId++); - cst_limited_array.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_limited_array.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_limited_array.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_limited_array.common().member_flags().IS_OPTIONAL(false); - cst_limited_array.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_limited_array.common().member_flags().IS_KEY(false); - cst_limited_array.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_limited_array.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("AnInternalObject", {10}, true)); - - - cst_limited_array.detail().name("limited_array"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_limited_array); - - - // Header - type_object->complete().struct_type().header().detail().type_name("arrays_and_sequences"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("arrays_and_sequences", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.h deleted file mode 100644 index 4ad8329f..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/arrays_and_sequencesTypeObject.h +++ /dev/null @@ -1,72 +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 arrays_and_sequencesTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(arrays_and_sequences_SOURCE) -#define arrays_and_sequences_DllAPI __declspec( dllexport ) -#else -#define arrays_and_sequences_DllAPI __declspec( dllimport ) -#endif // arrays_and_sequences_SOURCE -#else -#define arrays_and_sequences_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define arrays_and_sequences_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerarrays_and_sequencesTypes(); - -eProsima_user_DllExport const TypeIdentifier* GetAnInternalObjectIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetAnInternalObjectObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalAnInternalObjectObject(); -eProsima_user_DllExport const TypeObject* GetCompleteAnInternalObjectObject(); - -eProsima_user_DllExport const TypeIdentifier* Getarrays_and_sequencesIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Getarrays_and_sequencesObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalarrays_and_sequencesObject(); -eProsima_user_DllExport const TypeObject* GetCompletearrays_and_sequencesObject(); - - -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.cxx deleted file mode 100644 index 0d39bc85..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.cxx +++ /dev/null @@ -1,442 +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 basic_array_struct.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "basic_array_struct.h" -#include "basic_array_structTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -TheOtherObjectInArray::TheOtherObjectInArray() -{ - // m_some_num com.eprosima.idl.parser.typecode.PrimitiveTypeCode@32709393 - m_some_num = 0; - // m_positive com.eprosima.idl.parser.typecode.PrimitiveTypeCode@3d99d22e - m_positive = false; - - // Just to register all known types - registerbasic_array_structTypes(); -} - -TheOtherObjectInArray::~TheOtherObjectInArray() -{ - - -} - -TheOtherObjectInArray::TheOtherObjectInArray( - const TheOtherObjectInArray& x) -{ - m_some_num = x.m_some_num; - m_positive = x.m_positive; -} - -TheOtherObjectInArray::TheOtherObjectInArray( - TheOtherObjectInArray&& x) noexcept -{ - m_some_num = x.m_some_num; - m_positive = x.m_positive; -} - -TheOtherObjectInArray& TheOtherObjectInArray::operator =( - const TheOtherObjectInArray& x) -{ - - m_some_num = x.m_some_num; - m_positive = x.m_positive; - - return *this; -} - -TheOtherObjectInArray& TheOtherObjectInArray::operator =( - TheOtherObjectInArray&& x) noexcept -{ - - m_some_num = x.m_some_num; - m_positive = x.m_positive; - - return *this; -} - -bool TheOtherObjectInArray::operator ==( - const TheOtherObjectInArray& x) const -{ - - return (m_some_num == x.m_some_num && m_positive == x.m_positive); -} - -bool TheOtherObjectInArray::operator !=( - const TheOtherObjectInArray& x) const -{ - return !(*this == x); -} - -size_t TheOtherObjectInArray::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - -size_t TheOtherObjectInArray::getCdrSerializedSize( - const TheOtherObjectInArray& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - -void TheOtherObjectInArray::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_some_num; - scdr << m_positive; - -} - -void TheOtherObjectInArray::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_some_num; - dcdr >> m_positive; -} - -/*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ -void TheOtherObjectInArray::some_num( - int32_t _some_num) -{ - m_some_num = _some_num; -} - -/*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ -int32_t TheOtherObjectInArray::some_num() const -{ - return m_some_num; -} - -/*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ -int32_t& TheOtherObjectInArray::some_num() -{ - return m_some_num; -} - -/*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ -void TheOtherObjectInArray::positive( - bool _positive) -{ - m_positive = _positive; -} - -/*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ -bool TheOtherObjectInArray::positive() const -{ - return m_positive; -} - -/*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ -bool& TheOtherObjectInArray::positive() -{ - return m_positive; -} - - -size_t TheOtherObjectInArray::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - return current_align; -} - -bool TheOtherObjectInArray::isKeyDefined() -{ - return false; -} - -void TheOtherObjectInArray::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} - -basic_array_struct::basic_array_struct() -{ - // m_index com.eprosima.idl.parser.typecode.PrimitiveTypeCode@50d0686 - m_index = 0; - // m_sub_structs com.eprosima.idl.parser.typecode.ArrayTypeCode@1e7c7811 - - - // Just to register all known types - registerbasic_array_structTypes(); -} - -basic_array_struct::~basic_array_struct() -{ - - -} - -basic_array_struct::basic_array_struct( - const basic_array_struct& x) -{ - m_index = x.m_index; - m_sub_structs = x.m_sub_structs; -} - -basic_array_struct::basic_array_struct( - basic_array_struct&& x) noexcept -{ - m_index = x.m_index; - m_sub_structs = std::move(x.m_sub_structs); -} - -basic_array_struct& basic_array_struct::operator =( - const basic_array_struct& x) -{ - - m_index = x.m_index; - m_sub_structs = x.m_sub_structs; - - return *this; -} - -basic_array_struct& basic_array_struct::operator =( - basic_array_struct&& x) noexcept -{ - - m_index = x.m_index; - m_sub_structs = std::move(x.m_sub_structs); - - return *this; -} - -bool basic_array_struct::operator ==( - const basic_array_struct& x) const -{ - - return (m_index == x.m_index && m_sub_structs == x.m_sub_structs); -} - -bool basic_array_struct::operator !=( - const basic_array_struct& x) const -{ - return !(*this == x); -} - -size_t basic_array_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - for(size_t a = 0; a < (5); ++a) - { - current_alignment += TheOtherObjectInArray::getMaxCdrSerializedSize(current_alignment);} - - return current_alignment - initial_alignment; -} - -size_t basic_array_struct::getCdrSerializedSize( - const basic_array_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - for(size_t a = 0; a < data.sub_structs().size(); ++a) - { - current_alignment += TheOtherObjectInArray::getCdrSerializedSize(data.sub_structs().at(a), current_alignment); - } - - return current_alignment - initial_alignment; -} - -void basic_array_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_index; - scdr << m_sub_structs; - - -} - -void basic_array_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_index; - dcdr >> m_sub_structs; - -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void basic_array_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t basic_array_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& basic_array_struct::index() -{ - return m_index; -} - -/*! - * @brief This function copies the value in member sub_structs - * @param _sub_structs New value to be copied in member sub_structs - */ -void basic_array_struct::sub_structs( - const std::array& _sub_structs) -{ - m_sub_structs = _sub_structs; -} - -/*! - * @brief This function moves the value in member sub_structs - * @param _sub_structs New value to be moved in member sub_structs - */ -void basic_array_struct::sub_structs( - std::array&& _sub_structs) -{ - m_sub_structs = std::move(_sub_structs); -} - -/*! - * @brief This function returns a constant reference to member sub_structs - * @return Constant reference to member sub_structs - */ -const std::array& basic_array_struct::sub_structs() const -{ - return m_sub_structs; -} - -/*! - * @brief This function returns a reference to member sub_structs - * @return Reference to member sub_structs - */ -std::array& basic_array_struct::sub_structs() -{ - return m_sub_structs; -} - -size_t basic_array_struct::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - return current_align; -} - -bool basic_array_struct::isKeyDefined() -{ - return false; -} - -void basic_array_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.h deleted file mode 100644 index 920978d7..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_struct.h +++ /dev/null @@ -1,395 +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 basic_array_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(basic_array_struct_SOURCE) -#define basic_array_struct_DllAPI __declspec( dllexport ) -#else -#define basic_array_struct_DllAPI __declspec( dllimport ) -#endif // basic_array_struct_SOURCE -#else -#define basic_array_struct_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define basic_array_struct_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure TheOtherObjectInArray defined by the user in the IDL file. - * @ingroup BASIC_ARRAY_STRUCT - */ -class TheOtherObjectInArray -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport TheOtherObjectInArray(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~TheOtherObjectInArray(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray( - const TheOtherObjectInArray& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray( - TheOtherObjectInArray&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray& operator =( - const TheOtherObjectInArray& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray& operator =( - TheOtherObjectInArray&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x TheOtherObjectInArray object to compare. - */ - eProsima_user_DllExport bool operator ==( - const TheOtherObjectInArray& x) const; - - /*! - * @brief Comparison operator. - * @param x TheOtherObjectInArray object to compare. - */ - eProsima_user_DllExport bool operator !=( - const TheOtherObjectInArray& x) const; - - /*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ - eProsima_user_DllExport void some_num( - int32_t _some_num); - - /*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ - eProsima_user_DllExport int32_t some_num() const; - - /*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ - eProsima_user_DllExport int32_t& some_num(); - - /*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ - eProsima_user_DllExport void positive( - bool _positive); - - /*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ - eProsima_user_DllExport bool positive() const; - - /*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ - eProsima_user_DllExport bool& positive(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const TheOtherObjectInArray& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - int32_t m_some_num; - bool m_positive; -}; -/*! - * @brief This class represents the structure basic_array_struct defined by the user in the IDL file. - * @ingroup BASIC_ARRAY_STRUCT - */ -class basic_array_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport basic_array_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~basic_array_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct( - const basic_array_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct( - basic_array_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct& operator =( - const basic_array_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct& operator =( - basic_array_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x basic_array_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const basic_array_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x basic_array_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const basic_array_struct& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - /*! - * @brief This function copies the value in member sub_structs - * @param _sub_structs New value to be copied in member sub_structs - */ - eProsima_user_DllExport void sub_structs( - const std::array& _sub_structs); - - /*! - * @brief This function moves the value in member sub_structs - * @param _sub_structs New value to be moved in member sub_structs - */ - eProsima_user_DllExport void sub_structs( - std::array&& _sub_structs); - - /*! - * @brief This function returns a constant reference to member sub_structs - * @return Constant reference to member sub_structs - */ - eProsima_user_DllExport const std::array& sub_structs() const; - - /*! - * @brief This function returns a reference to member sub_structs - * @return Reference to member sub_structs - */ - eProsima_user_DllExport std::array& sub_structs(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const basic_array_struct& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - uint32_t m_index; - std::array m_sub_structs; -}; - -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.cxx deleted file mode 100644 index dd4dff4e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.cxx +++ /dev/null @@ -1,309 +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 basic_array_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "basic_array_structPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -TheOtherObjectInArrayPubSubType::TheOtherObjectInArrayPubSubType() -{ - setName("TheOtherObjectInArray"); - auto type_size = TheOtherObjectInArray::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = TheOtherObjectInArray::isKeyDefined(); - size_t keyLength = TheOtherObjectInArray::getKeyMaxCdrSerializedSize() > 16 ? - TheOtherObjectInArray::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -TheOtherObjectInArrayPubSubType::~TheOtherObjectInArrayPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool TheOtherObjectInArrayPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - TheOtherObjectInArray* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool TheOtherObjectInArrayPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - TheOtherObjectInArray* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function TheOtherObjectInArrayPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* TheOtherObjectInArrayPubSubType::createData() -{ - return reinterpret_cast(new TheOtherObjectInArray()); -} - -void TheOtherObjectInArrayPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool TheOtherObjectInArrayPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - TheOtherObjectInArray* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - TheOtherObjectInArray::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || TheOtherObjectInArray::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -basic_array_structPubSubType::basic_array_structPubSubType() -{ - setName("basic_array_struct"); - auto type_size = basic_array_struct::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = basic_array_struct::isKeyDefined(); - size_t keyLength = basic_array_struct::getKeyMaxCdrSerializedSize() > 16 ? - basic_array_struct::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -basic_array_structPubSubType::~basic_array_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool basic_array_structPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - basic_array_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool basic_array_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - basic_array_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function basic_array_structPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* basic_array_structPubSubType::createData() -{ - return reinterpret_cast(new basic_array_struct()); -} - -void basic_array_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool basic_array_structPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - basic_array_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - basic_array_struct::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || basic_array_struct::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.h deleted file mode 100644 index e382e8d4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structPubSubTypes.h +++ /dev/null @@ -1,165 +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 basic_array_structPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_PUBSUBTYPES_H_ - -#include -#include - -#include "basic_array_struct.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated basic_array_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type TheOtherObjectInArray defined by the user in the IDL file. - * @ingroup BASIC_ARRAY_STRUCT - */ -class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef TheOtherObjectInArray type; - - eProsima_user_DllExport TheOtherObjectInArrayPubSubType(); - - eProsima_user_DllExport virtual ~TheOtherObjectInArrayPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) TheOtherObjectInArray(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; -/*! - * @brief This class represents the TopicDataType of the type basic_array_struct defined by the user in the IDL file. - * @ingroup BASIC_ARRAY_STRUCT - */ -class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef basic_array_struct type; - - eProsima_user_DllExport basic_array_structPubSubType(); - - eProsima_user_DllExport virtual ~basic_array_structPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) basic_array_struct(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.cxx deleted file mode 100644 index 29f15c6f..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.cxx +++ /dev/null @@ -1,450 +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 basic_array_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "basic_array_struct.h" -#include "basic_array_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerbasic_array_structTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("TheOtherObjectInArray", GetTheOtherObjectInArrayIdentifier(true), - GetTheOtherObjectInArrayObject(true)); - factory->add_type_object("TheOtherObjectInArray", GetTheOtherObjectInArrayIdentifier(false), - GetTheOtherObjectInArrayObject(false)); - - factory->add_type_object("basic_array_struct", Getbasic_array_structIdentifier(true), - Getbasic_array_structObject(true)); - factory->add_type_object("basic_array_struct", Getbasic_array_structIdentifier(false), - Getbasic_array_structObject(false)); - -} - -const TypeIdentifier* GetTheOtherObjectInArrayIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObjectInArray", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetTheOtherObjectInArrayObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObjectInArray", complete); -} - -const TypeObject* GetTheOtherObjectInArrayObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteTheOtherObjectInArrayObject(); - } - //else - return GetMinimalTheOtherObjectInArrayObject(); -} - -const TypeObject* GetMinimalTheOtherObjectInArrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_some_num; - mst_some_num.common().member_id(memberId++); - mst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_some_num.common().member_flags().IS_OPTIONAL(false); - mst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_some_num.common().member_flags().IS_KEY(false); - mst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - MD5 some_num_hash("some_num"); - for(int i = 0; i < 4; ++i) - { - mst_some_num.detail().name_hash()[i] = some_num_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_some_num); - - MinimalStructMember mst_positive; - mst_positive.common().member_id(memberId++); - mst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_positive.common().member_flags().IS_OPTIONAL(false); - mst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_positive.common().member_flags().IS_KEY(false); - mst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - MD5 positive_hash("positive"); - for(int i = 0; i < 4; ++i) - { - mst_positive.detail().name_hash()[i] = positive_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_positive); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObjectInArray", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", false); -} - -const TypeObject* GetCompleteTheOtherObjectInArrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_some_num; - cst_some_num.common().member_id(memberId++); - cst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_some_num.common().member_flags().IS_OPTIONAL(false); - cst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_some_num.common().member_flags().IS_KEY(false); - cst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - cst_some_num.detail().name("some_num"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_some_num); - - CompleteStructMember cst_positive; - cst_positive.common().member_id(memberId++); - cst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_positive.common().member_flags().IS_OPTIONAL(false); - cst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_positive.common().member_flags().IS_KEY(false); - cst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - cst_positive.detail().name("positive"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_positive); - - - // Header - type_object->complete().struct_type().header().detail().type_name("TheOtherObjectInArray"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObjectInArray", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", true); -} - -const TypeIdentifier* Getbasic_array_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("basic_array_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getbasic_array_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("basic_array_struct", complete); -} - -const TypeObject* Getbasic_array_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletebasic_array_structObject(); - } - //else - return GetMinimalbasic_array_structObject(); -} - -const TypeObject* GetMinimalbasic_array_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_sub_structs; - mst_sub_structs.common().member_id(memberId++); - mst_sub_structs.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_sub_structs.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_sub_structs.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_sub_structs.common().member_flags().IS_OPTIONAL(false); - mst_sub_structs.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_sub_structs.common().member_flags().IS_KEY(false); - mst_sub_structs.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_sub_structs.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("TheOtherObjectInArray", {5}, false)); - - - MD5 sub_structs_hash("sub_structs"); - for(int i = 0; i < 4; ++i) - { - mst_sub_structs.detail().name_hash()[i] = sub_structs_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_sub_structs); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_array_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", false); -} - -const TypeObject* GetCompletebasic_array_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_sub_structs; - cst_sub_structs.common().member_id(memberId++); - cst_sub_structs.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_sub_structs.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_sub_structs.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_sub_structs.common().member_flags().IS_OPTIONAL(false); - cst_sub_structs.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_sub_structs.common().member_flags().IS_KEY(false); - cst_sub_structs.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_sub_structs.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("TheOtherObjectInArray", {5}, true)); - - - cst_sub_structs.detail().name("sub_structs"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_sub_structs); - - - // Header - type_object->complete().struct_type().header().detail().type_name("basic_array_struct"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_array_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.h deleted file mode 100644 index 097559ae..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_array_structTypeObject.h +++ /dev/null @@ -1,72 +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 basic_array_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(basic_array_struct_SOURCE) -#define basic_array_struct_DllAPI __declspec( dllexport ) -#else -#define basic_array_struct_DllAPI __declspec( dllimport ) -#endif // basic_array_struct_SOURCE -#else -#define basic_array_struct_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define basic_array_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerbasic_array_structTypes(); - -eProsima_user_DllExport const TypeIdentifier* GetTheOtherObjectInArrayIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetTheOtherObjectInArrayObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalTheOtherObjectInArrayObject(); -eProsima_user_DllExport const TypeObject* GetCompleteTheOtherObjectInArrayObject(); - -eProsima_user_DllExport const TypeIdentifier* Getbasic_array_structIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Getbasic_array_structObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalbasic_array_structObject(); -eProsima_user_DllExport const TypeObject* GetCompletebasic_array_structObject(); - - -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.cxx deleted file mode 100644 index 009a888b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.cxx +++ /dev/null @@ -1,339 +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 basic_struct.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "basic_struct.h" -#include "basic_structTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -TheOtherObject::TheOtherObject() -{ - // m_some_num com.eprosima.idl.parser.typecode.PrimitiveTypeCode@3cef309d - m_some_num = 0; - - // Just to register all known types - registerbasic_structTypes(); -} - -TheOtherObject::~TheOtherObject() -{ -} - -TheOtherObject::TheOtherObject( - const TheOtherObject& x) -{ - m_some_num = x.m_some_num; -} - -TheOtherObject::TheOtherObject( - TheOtherObject&& x) noexcept -{ - m_some_num = x.m_some_num; -} - -TheOtherObject& TheOtherObject::operator =( - const TheOtherObject& x) -{ - - m_some_num = x.m_some_num; - - return *this; -} - -TheOtherObject& TheOtherObject::operator =( - TheOtherObject&& x) noexcept -{ - - m_some_num = x.m_some_num; - - return *this; -} - -bool TheOtherObject::operator ==( - const TheOtherObject& x) const -{ - - return (m_some_num == x.m_some_num); -} - -bool TheOtherObject::operator !=( - const TheOtherObject& x) const -{ - return !(*this == x); -} - -size_t TheOtherObject::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - -size_t TheOtherObject::getCdrSerializedSize( - const TheOtherObject& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - -void TheOtherObject::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_some_num; - -} - -void TheOtherObject::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_some_num; -} - -/*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ -void TheOtherObject::some_num( - int32_t _some_num) -{ - m_some_num = _some_num; -} - -/*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ -int32_t TheOtherObject::some_num() const -{ - return m_some_num; -} - -/*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ -int32_t& TheOtherObject::some_num() -{ - return m_some_num; -} - - -size_t TheOtherObject::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - return current_align; -} - -bool TheOtherObject::isKeyDefined() -{ - return false; -} - -void TheOtherObject::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} - -basic_struct::basic_struct() -{ - // m_sub_struct com.eprosima.fastdds.idl.parser.typecode.StructTypeCode@5bcea91b - - - // Just to register all known types - registerbasic_structTypes(); -} - -basic_struct::~basic_struct() -{ -} - -basic_struct::basic_struct( - const basic_struct& x) -{ - m_sub_struct = x.m_sub_struct; -} - -basic_struct::basic_struct( - basic_struct&& x) noexcept -{ - m_sub_struct = std::move(x.m_sub_struct); -} - -basic_struct& basic_struct::operator =( - const basic_struct& x) -{ - - m_sub_struct = x.m_sub_struct; - - return *this; -} - -basic_struct& basic_struct::operator =( - basic_struct&& x) noexcept -{ - - m_sub_struct = std::move(x.m_sub_struct); - - return *this; -} - -bool basic_struct::operator ==( - const basic_struct& x) const -{ - - return (m_sub_struct == x.m_sub_struct); -} - -bool basic_struct::operator !=( - const basic_struct& x) const -{ - return !(*this == x); -} - -size_t basic_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += TheOtherObject::getMaxCdrSerializedSize(current_alignment); - - return current_alignment - initial_alignment; -} - -size_t basic_struct::getCdrSerializedSize( - const basic_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += TheOtherObject::getCdrSerializedSize(data.sub_struct(), current_alignment); - - return current_alignment - initial_alignment; -} - -void basic_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_sub_struct; - -} - -void basic_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_sub_struct; -} - -/*! - * @brief This function copies the value in member sub_struct - * @param _sub_struct New value to be copied in member sub_struct - */ -void basic_struct::sub_struct( - const TheOtherObject& _sub_struct) -{ - m_sub_struct = _sub_struct; -} - -/*! - * @brief This function moves the value in member sub_struct - * @param _sub_struct New value to be moved in member sub_struct - */ -void basic_struct::sub_struct( - TheOtherObject&& _sub_struct) -{ - m_sub_struct = std::move(_sub_struct); -} - -/*! - * @brief This function returns a constant reference to member sub_struct - * @return Constant reference to member sub_struct - */ -const TheOtherObject& basic_struct::sub_struct() const -{ - return m_sub_struct; -} - -/*! - * @brief This function returns a reference to member sub_struct - * @return Reference to member sub_struct - */ -TheOtherObject& basic_struct::sub_struct() -{ - return m_sub_struct; -} - -size_t basic_struct::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - return current_align; -} - -bool basic_struct::isKeyDefined() -{ - return false; -} - -void basic_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.h deleted file mode 100644 index 53e1fe9e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_struct.h +++ /dev/null @@ -1,355 +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 basic_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_H_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(basic_struct_SOURCE) -#define basic_struct_DllAPI __declspec( dllexport ) -#else -#define basic_struct_DllAPI __declspec( dllimport ) -#endif // basic_struct_SOURCE -#else -#define basic_struct_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define basic_struct_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure TheOtherObject defined by the user in the IDL file. - * @ingroup BASIC_STRUCT - */ -class TheOtherObject -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport TheOtherObject(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~TheOtherObject(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject( - const TheOtherObject& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject( - TheOtherObject&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject& operator =( - const TheOtherObject& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject& operator =( - TheOtherObject&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x TheOtherObject object to compare. - */ - eProsima_user_DllExport bool operator ==( - const TheOtherObject& x) const; - - /*! - * @brief Comparison operator. - * @param x TheOtherObject object to compare. - */ - eProsima_user_DllExport bool operator !=( - const TheOtherObject& x) const; - - /*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ - eProsima_user_DllExport void some_num( - int32_t _some_num); - - /*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ - eProsima_user_DllExport int32_t some_num() const; - - /*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ - eProsima_user_DllExport int32_t& some_num(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const TheOtherObject& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - int32_t m_some_num; -}; -/*! - * @brief This class represents the structure basic_struct defined by the user in the IDL file. - * @ingroup BASIC_STRUCT - */ -class basic_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport basic_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~basic_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct( - const basic_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct( - basic_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct& operator =( - const basic_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct& operator =( - basic_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x basic_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const basic_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x basic_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const basic_struct& x) const; - - /*! - * @brief This function copies the value in member sub_struct - * @param _sub_struct New value to be copied in member sub_struct - */ - eProsima_user_DllExport void sub_struct( - const TheOtherObject& _sub_struct); - - /*! - * @brief This function moves the value in member sub_struct - * @param _sub_struct New value to be moved in member sub_struct - */ - eProsima_user_DllExport void sub_struct( - TheOtherObject&& _sub_struct); - - /*! - * @brief This function returns a constant reference to member sub_struct - * @return Constant reference to member sub_struct - */ - eProsima_user_DllExport const TheOtherObject& sub_struct() const; - - /*! - * @brief This function returns a reference to member sub_struct - * @return Reference to member sub_struct - */ - eProsima_user_DllExport TheOtherObject& sub_struct(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const basic_struct& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - TheOtherObject m_sub_struct; -}; - -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.cxx deleted file mode 100644 index 04cc05b7..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.cxx +++ /dev/null @@ -1,309 +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 basic_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "basic_structPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -TheOtherObjectPubSubType::TheOtherObjectPubSubType() -{ - setName("TheOtherObject"); - auto type_size = TheOtherObject::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = TheOtherObject::isKeyDefined(); - size_t keyLength = TheOtherObject::getKeyMaxCdrSerializedSize() > 16 ? - TheOtherObject::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -TheOtherObjectPubSubType::~TheOtherObjectPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool TheOtherObjectPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - TheOtherObject* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool TheOtherObjectPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - TheOtherObject* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function TheOtherObjectPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* TheOtherObjectPubSubType::createData() -{ - return reinterpret_cast(new TheOtherObject()); -} - -void TheOtherObjectPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool TheOtherObjectPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - TheOtherObject* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - TheOtherObject::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || TheOtherObject::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -basic_structPubSubType::basic_structPubSubType() -{ - setName("basic_struct"); - auto type_size = basic_struct::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = basic_struct::isKeyDefined(); - size_t keyLength = basic_struct::getKeyMaxCdrSerializedSize() > 16 ? - basic_struct::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -basic_structPubSubType::~basic_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool basic_structPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - basic_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool basic_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - basic_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function basic_structPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* basic_structPubSubType::createData() -{ - return reinterpret_cast(new basic_struct()); -} - -void basic_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool basic_structPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - basic_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - basic_struct::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || basic_struct::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.h deleted file mode 100644 index cec5fc93..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structPubSubTypes.h +++ /dev/null @@ -1,165 +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 basic_structPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_PUBSUBTYPES_H_ - -#include -#include - -#include "basic_struct.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated basic_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type TheOtherObject defined by the user in the IDL file. - * @ingroup BASIC_STRUCT - */ -class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef TheOtherObject type; - - eProsima_user_DllExport TheOtherObjectPubSubType(); - - eProsima_user_DllExport virtual ~TheOtherObjectPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) TheOtherObject(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; -/*! - * @brief This class represents the TopicDataType of the type basic_struct defined by the user in the IDL file. - * @ingroup BASIC_STRUCT - */ -class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef basic_struct type; - - eProsima_user_DllExport basic_structPubSubType(); - - eProsima_user_DllExport virtual ~basic_structPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) basic_struct(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.cxx deleted file mode 100644 index b881ad94..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.cxx +++ /dev/null @@ -1,380 +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 basic_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "basic_struct.h" -#include "basic_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerbasic_structTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("TheOtherObject", GetTheOtherObjectIdentifier(true), - GetTheOtherObjectObject(true)); - factory->add_type_object("TheOtherObject", GetTheOtherObjectIdentifier(false), - GetTheOtherObjectObject(false)); - - factory->add_type_object("basic_struct", Getbasic_structIdentifier(true), - Getbasic_structObject(true)); - factory->add_type_object("basic_struct", Getbasic_structIdentifier(false), - Getbasic_structObject(false)); - -} - -const TypeIdentifier* GetTheOtherObjectIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObject", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetTheOtherObjectObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObject", complete); -} - -const TypeObject* GetTheOtherObjectObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteTheOtherObjectObject(); - } - //else - return GetMinimalTheOtherObjectObject(); -} - -const TypeObject* GetMinimalTheOtherObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_some_num; - mst_some_num.common().member_id(memberId++); - mst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_some_num.common().member_flags().IS_OPTIONAL(false); - mst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_some_num.common().member_flags().IS_KEY(false); - mst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - MD5 some_num_hash("some_num"); - for(int i = 0; i < 4; ++i) - { - mst_some_num.detail().name_hash()[i] = some_num_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_some_num); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", false); -} - -const TypeObject* GetCompleteTheOtherObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_some_num; - cst_some_num.common().member_id(memberId++); - cst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_some_num.common().member_flags().IS_OPTIONAL(false); - cst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_some_num.common().member_flags().IS_KEY(false); - cst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - cst_some_num.detail().name("some_num"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_some_num); - - - // Header - type_object->complete().struct_type().header().detail().type_name("TheOtherObject"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", true); -} - -const TypeIdentifier* Getbasic_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("basic_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getbasic_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("basic_struct", complete); -} - -const TypeObject* Getbasic_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletebasic_structObject(); - } - //else - return GetMinimalbasic_structObject(); -} - -const TypeObject* GetMinimalbasic_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_sub_struct; - mst_sub_struct.common().member_id(memberId++); - mst_sub_struct.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_sub_struct.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_sub_struct.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_sub_struct.common().member_flags().IS_OPTIONAL(false); - mst_sub_struct.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_sub_struct.common().member_flags().IS_KEY(false); - mst_sub_struct.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_sub_struct.common().member_type_id(*GetTheOtherObjectIdentifier(false)); - MD5 sub_struct_hash("sub_struct"); - for(int i = 0; i < 4; ++i) - { - mst_sub_struct.detail().name_hash()[i] = sub_struct_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_sub_struct); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_struct", false); -} - -const TypeObject* GetCompletebasic_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_sub_struct; - cst_sub_struct.common().member_id(memberId++); - cst_sub_struct.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_sub_struct.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_sub_struct.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_sub_struct.common().member_flags().IS_OPTIONAL(false); - cst_sub_struct.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_sub_struct.common().member_flags().IS_KEY(false); - cst_sub_struct.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_sub_struct.common().member_type_id(*GetTheOtherObjectIdentifier(true)); - cst_sub_struct.detail().name("sub_struct"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_sub_struct); - - - // Header - type_object->complete().struct_type().header().detail().type_name("basic_struct"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.h deleted file mode 100644 index 04ad8848..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/basic_structTypeObject.h +++ /dev/null @@ -1,72 +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 basic_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(basic_struct_SOURCE) -#define basic_struct_DllAPI __declspec( dllexport ) -#else -#define basic_struct_DllAPI __declspec( dllimport ) -#endif // basic_struct_SOURCE -#else -#define basic_struct_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define basic_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerbasic_structTypes(); - -eProsima_user_DllExport const TypeIdentifier* GetTheOtherObjectIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetTheOtherObjectObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalTheOtherObjectObject(); -eProsima_user_DllExport const TypeObject* GetCompleteTheOtherObjectObject(); - -eProsima_user_DllExport const TypeIdentifier* Getbasic_structIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Getbasic_structObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalbasic_structObject(); -eProsima_user_DllExport const TypeObject* GetCompletebasic_structObject(); - - -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.cxx deleted file mode 100644 index 14eefab1..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.cxx +++ /dev/null @@ -1,200 +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 char_sequence.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "char_sequence.h" -#include "char_sequenceTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -char_sequence::char_sequence() -{ - // m_chars com.eprosima.idl.parser.typecode.SequenceTypeCode@3fd7a715 - - - // Just to register all known types - registerchar_sequenceTypes(); -} - -char_sequence::~char_sequence() -{ -} - -char_sequence::char_sequence( - const char_sequence& x) -{ - m_chars = x.m_chars; -} - -char_sequence::char_sequence( - char_sequence&& x) noexcept -{ - m_chars = std::move(x.m_chars); -} - -char_sequence& char_sequence::operator =( - const char_sequence& x) -{ - - m_chars = x.m_chars; - - return *this; -} - -char_sequence& char_sequence::operator =( - char_sequence&& x) noexcept -{ - - m_chars = std::move(x.m_chars); - - return *this; -} - -bool char_sequence::operator ==( - const char_sequence& x) const -{ - - return (m_chars == x.m_chars); -} - -bool char_sequence::operator !=( - const char_sequence& x) const -{ - return !(*this == x); -} - -size_t char_sequence::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - -size_t char_sequence::getCdrSerializedSize( - const char_sequence& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - if (data.chars().size() > 0) - { - current_alignment += (data.chars().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - } - - - - return current_alignment - initial_alignment; -} - -void char_sequence::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_chars; -} - -void char_sequence::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_chars;} - -/*! - * @brief This function copies the value in member chars - * @param _chars New value to be copied in member chars - */ -void char_sequence::chars( - const std::vector& _chars) -{ - m_chars = _chars; -} - -/*! - * @brief This function moves the value in member chars - * @param _chars New value to be moved in member chars - */ -void char_sequence::chars( - std::vector&& _chars) -{ - m_chars = std::move(_chars); -} - -/*! - * @brief This function returns a constant reference to member chars - * @return Constant reference to member chars - */ -const std::vector& char_sequence::chars() const -{ - return m_chars; -} - -/*! - * @brief This function returns a reference to member chars - * @return Reference to member chars - */ -std::vector& char_sequence::chars() -{ - return m_chars; -} - -size_t char_sequence::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - return current_align; -} - -bool char_sequence::isKeyDefined() -{ - return false; -} - -void char_sequence::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.h deleted file mode 100644 index 51c2bd1a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequence.h +++ /dev/null @@ -1,214 +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 char_sequence.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(char_sequence_SOURCE) -#define char_sequence_DllAPI __declspec( dllexport ) -#else -#define char_sequence_DllAPI __declspec( dllimport ) -#endif // char_sequence_SOURCE -#else -#define char_sequence_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define char_sequence_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure char_sequence defined by the user in the IDL file. - * @ingroup CHAR_SEQUENCE - */ -class char_sequence -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport char_sequence(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~char_sequence(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence( - const char_sequence& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence( - char_sequence&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence& operator =( - const char_sequence& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence& operator =( - char_sequence&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x char_sequence object to compare. - */ - eProsima_user_DllExport bool operator ==( - const char_sequence& x) const; - - /*! - * @brief Comparison operator. - * @param x char_sequence object to compare. - */ - eProsima_user_DllExport bool operator !=( - const char_sequence& x) const; - - /*! - * @brief This function copies the value in member chars - * @param _chars New value to be copied in member chars - */ - eProsima_user_DllExport void chars( - const std::vector& _chars); - - /*! - * @brief This function moves the value in member chars - * @param _chars New value to be moved in member chars - */ - eProsima_user_DllExport void chars( - std::vector&& _chars); - - /*! - * @brief This function returns a constant reference to member chars - * @return Constant reference to member chars - */ - eProsima_user_DllExport const std::vector& chars() const; - - /*! - * @brief This function returns a reference to member chars - * @return Reference to member chars - */ - eProsima_user_DllExport std::vector& chars(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const char_sequence& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::vector m_chars; -}; - -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.cxx deleted file mode 100644 index d0fb01af..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.cxx +++ /dev/null @@ -1,169 +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 char_sequencePubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "char_sequencePubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -char_sequencePubSubType::char_sequencePubSubType() -{ - setName("char_sequence"); - auto type_size = char_sequence::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = char_sequence::isKeyDefined(); - size_t keyLength = char_sequence::getKeyMaxCdrSerializedSize() > 16 ? - char_sequence::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -char_sequencePubSubType::~char_sequencePubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool char_sequencePubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - char_sequence* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool char_sequencePubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - char_sequence* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function char_sequencePubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* char_sequencePubSubType::createData() -{ - return reinterpret_cast(new char_sequence()); -} - -void char_sequencePubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool char_sequencePubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - char_sequence* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - char_sequence::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || char_sequence::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.h deleted file mode 100644 index bfd9912d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequencePubSubTypes.h +++ /dev/null @@ -1,101 +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 char_sequencePubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_PUBSUBTYPES_H_ - -#include -#include - -#include "char_sequence.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated char_sequence is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type char_sequence defined by the user in the IDL file. - * @ingroup CHAR_SEQUENCE - */ -class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef char_sequence type; - - eProsima_user_DllExport char_sequencePubSubType(); - - eProsima_user_DllExport virtual ~char_sequencePubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.cxx deleted file mode 100644 index 2bb805f5..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.cxx +++ /dev/null @@ -1,215 +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 char_sequenceTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "char_sequence.h" -#include "char_sequenceTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerchar_sequenceTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("char_sequence", Getchar_sequenceIdentifier(true), - Getchar_sequenceObject(true)); - factory->add_type_object("char_sequence", Getchar_sequenceIdentifier(false), - Getchar_sequenceObject(false)); - -} - -const TypeIdentifier* Getchar_sequenceIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("char_sequence", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getchar_sequenceObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("char_sequence", complete); -} - -const TypeObject* Getchar_sequenceObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("char_sequence", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletechar_sequenceObject(); - } - //else - return GetMinimalchar_sequenceObject(); -} - -const TypeObject* GetMinimalchar_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("char_sequence", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_chars; - mst_chars.common().member_id(memberId++); - mst_chars.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_chars.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_chars.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_chars.common().member_flags().IS_OPTIONAL(false); - mst_chars.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_chars.common().member_flags().IS_KEY(false); - mst_chars.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_chars.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("char", 0, false)); - - - MD5 chars_hash("chars"); - for(int i = 0; i < 4; ++i) - { - mst_chars.detail().name_hash()[i] = chars_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_chars); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("char_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("char_sequence", false); -} - -const TypeObject* GetCompletechar_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("char_sequence", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_chars; - cst_chars.common().member_id(memberId++); - cst_chars.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_chars.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_chars.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_chars.common().member_flags().IS_OPTIONAL(false); - cst_chars.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_chars.common().member_flags().IS_KEY(false); - cst_chars.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_chars.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("char", 0, true)); - - - cst_chars.detail().name("chars"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_chars); - - - // Header - type_object->complete().struct_type().header().detail().type_name("char_sequence"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("char_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("char_sequence", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.h deleted file mode 100644 index 82e51f80..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/char_sequenceTypeObject.h +++ /dev/null @@ -1,65 +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 char_sequenceTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(char_sequence_SOURCE) -#define char_sequence_DllAPI __declspec( dllexport ) -#else -#define char_sequence_DllAPI __declspec( dllimport ) -#endif // char_sequence_SOURCE -#else -#define char_sequence_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define char_sequence_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerchar_sequenceTypes(); - -eProsima_user_DllExport const TypeIdentifier* Getchar_sequenceIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Getchar_sequenceObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalchar_sequenceObject(); -eProsima_user_DllExport const TypeObject* GetCompletechar_sequenceObject(); - - -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.cxx deleted file mode 100644 index 2814386f..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.cxx +++ /dev/null @@ -1,881 +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 complex_nested_arrays.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "complex_nested_arrays.h" -#include "complex_nested_arraysTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -ThirdLevelElement::ThirdLevelElement() -{ - // m_x com.eprosima.idl.parser.typecode.PrimitiveTypeCode@47ef968d - m_x = 0.0; - // m_y com.eprosima.idl.parser.typecode.PrimitiveTypeCode@23e028a9 - m_y = 0.0; - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -ThirdLevelElement::~ThirdLevelElement() -{ - - -} - -ThirdLevelElement::ThirdLevelElement( - const ThirdLevelElement& x) -{ - m_x = x.m_x; - m_y = x.m_y; -} - -ThirdLevelElement::ThirdLevelElement( - ThirdLevelElement&& x) noexcept -{ - m_x = x.m_x; - m_y = x.m_y; -} - -ThirdLevelElement& ThirdLevelElement::operator =( - const ThirdLevelElement& x) -{ - - m_x = x.m_x; - m_y = x.m_y; - - return *this; -} - -ThirdLevelElement& ThirdLevelElement::operator =( - ThirdLevelElement&& x) noexcept -{ - - m_x = x.m_x; - m_y = x.m_y; - - return *this; -} - -bool ThirdLevelElement::operator ==( - const ThirdLevelElement& x) const -{ - - return (m_x == x.m_x && m_y == x.m_y); -} - -bool ThirdLevelElement::operator !=( - const ThirdLevelElement& x) const -{ - return !(*this == x); -} - -size_t ThirdLevelElement::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - - return current_alignment - initial_alignment; -} - -size_t ThirdLevelElement::getCdrSerializedSize( - const ThirdLevelElement& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - - return current_alignment - initial_alignment; -} - -void ThirdLevelElement::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_x; - scdr << m_y; - -} - -void ThirdLevelElement::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_x; - dcdr >> m_y; -} - -/*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ -void ThirdLevelElement::x( - double _x) -{ - m_x = _x; -} - -/*! - * @brief This function returns the value of member x - * @return Value of member x - */ -double ThirdLevelElement::x() const -{ - return m_x; -} - -/*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ -double& ThirdLevelElement::x() -{ - return m_x; -} - -/*! - * @brief This function sets a value in member y - * @param _y New value for member y - */ -void ThirdLevelElement::y( - double _y) -{ - m_y = _y; -} - -/*! - * @brief This function returns the value of member y - * @return Value of member y - */ -double ThirdLevelElement::y() const -{ - return m_y; -} - -/*! - * @brief This function returns a reference to member y - * @return Reference to member y - */ -double& ThirdLevelElement::y() -{ - return m_y; -} - - -size_t ThirdLevelElement::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - return current_align; -} - -bool ThirdLevelElement::isKeyDefined() -{ - return false; -} - -void ThirdLevelElement::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} - -SecondLevelElement::SecondLevelElement() -{ - // m_an_element_alone com.eprosima.fastdds.idl.parser.typecode.StructTypeCode@2db7a79b - - // m_a_limited_other_value com.eprosima.idl.parser.typecode.SequenceTypeCode@6950e31 - - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -SecondLevelElement::~SecondLevelElement() -{ - - -} - -SecondLevelElement::SecondLevelElement( - const SecondLevelElement& x) -{ - m_an_element_alone = x.m_an_element_alone; - m_a_limited_other_value = x.m_a_limited_other_value; -} - -SecondLevelElement::SecondLevelElement( - SecondLevelElement&& x) noexcept -{ - m_an_element_alone = std::move(x.m_an_element_alone); - m_a_limited_other_value = std::move(x.m_a_limited_other_value); -} - -SecondLevelElement& SecondLevelElement::operator =( - const SecondLevelElement& x) -{ - - m_an_element_alone = x.m_an_element_alone; - m_a_limited_other_value = x.m_a_limited_other_value; - - return *this; -} - -SecondLevelElement& SecondLevelElement::operator =( - SecondLevelElement&& x) noexcept -{ - - m_an_element_alone = std::move(x.m_an_element_alone); - m_a_limited_other_value = std::move(x.m_a_limited_other_value); - - return *this; -} - -bool SecondLevelElement::operator ==( - const SecondLevelElement& x) const -{ - - return (m_an_element_alone == x.m_an_element_alone && m_a_limited_other_value == x.m_a_limited_other_value); -} - -bool SecondLevelElement::operator !=( - const SecondLevelElement& x) const -{ - return !(*this == x); -} - -size_t SecondLevelElement::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += ThirdLevelElement::getMaxCdrSerializedSize(current_alignment); - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < 1; ++a) - { - current_alignment += ThirdLevelElement::getMaxCdrSerializedSize(current_alignment);} - - - return current_alignment - initial_alignment; -} - -size_t SecondLevelElement::getCdrSerializedSize( - const SecondLevelElement& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += ThirdLevelElement::getCdrSerializedSize(data.an_element_alone(), current_alignment); - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.a_limited_other_value().size(); ++a) - { - current_alignment += ThirdLevelElement::getCdrSerializedSize(data.a_limited_other_value().at(a), current_alignment);} - - - return current_alignment - initial_alignment; -} - -void SecondLevelElement::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_an_element_alone; - scdr << m_a_limited_other_value; - -} - -void SecondLevelElement::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_an_element_alone; - dcdr >> m_a_limited_other_value; -} - -/*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ -void SecondLevelElement::an_element_alone( - const ThirdLevelElement& _an_element_alone) -{ - m_an_element_alone = _an_element_alone; -} - -/*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ -void SecondLevelElement::an_element_alone( - ThirdLevelElement&& _an_element_alone) -{ - m_an_element_alone = std::move(_an_element_alone); -} - -/*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ -const ThirdLevelElement& SecondLevelElement::an_element_alone() const -{ - return m_an_element_alone; -} - -/*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ -ThirdLevelElement& SecondLevelElement::an_element_alone() -{ - return m_an_element_alone; -} -/*! - * @brief This function copies the value in member a_limited_other_value - * @param _a_limited_other_value New value to be copied in member a_limited_other_value - */ -void SecondLevelElement::a_limited_other_value( - const std::vector& _a_limited_other_value) -{ - m_a_limited_other_value = _a_limited_other_value; -} - -/*! - * @brief This function moves the value in member a_limited_other_value - * @param _a_limited_other_value New value to be moved in member a_limited_other_value - */ -void SecondLevelElement::a_limited_other_value( - std::vector&& _a_limited_other_value) -{ - m_a_limited_other_value = std::move(_a_limited_other_value); -} - -/*! - * @brief This function returns a constant reference to member a_limited_other_value - * @return Constant reference to member a_limited_other_value - */ -const std::vector& SecondLevelElement::a_limited_other_value() const -{ - return m_a_limited_other_value; -} - -/*! - * @brief This function returns a reference to member a_limited_other_value - * @return Reference to member a_limited_other_value - */ -std::vector& SecondLevelElement::a_limited_other_value() -{ - return m_a_limited_other_value; -} - -size_t SecondLevelElement::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - return current_align; -} - -bool SecondLevelElement::isKeyDefined() -{ - return false; -} - -void SecondLevelElement::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} - -FirstLevelElement::FirstLevelElement() -{ - // m_useless_name com.eprosima.idl.parser.typecode.StringTypeCode@5891e32e - m_useless_name =""; - // m_sub com.eprosima.idl.parser.typecode.SequenceTypeCode@cb0ed20 - - // m_an_element_alone com.eprosima.fastdds.idl.parser.typecode.StructTypeCode@2db7a79b - - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -FirstLevelElement::~FirstLevelElement() -{ - - - -} - -FirstLevelElement::FirstLevelElement( - const FirstLevelElement& x) -{ - m_useless_name = x.m_useless_name; - m_sub = x.m_sub; - m_an_element_alone = x.m_an_element_alone; -} - -FirstLevelElement::FirstLevelElement( - FirstLevelElement&& x) noexcept -{ - m_useless_name = std::move(x.m_useless_name); - m_sub = std::move(x.m_sub); - m_an_element_alone = std::move(x.m_an_element_alone); -} - -FirstLevelElement& FirstLevelElement::operator =( - const FirstLevelElement& x) -{ - - m_useless_name = x.m_useless_name; - m_sub = x.m_sub; - m_an_element_alone = x.m_an_element_alone; - - return *this; -} - -FirstLevelElement& FirstLevelElement::operator =( - FirstLevelElement&& x) noexcept -{ - - m_useless_name = std::move(x.m_useless_name); - m_sub = std::move(x.m_sub); - m_an_element_alone = std::move(x.m_an_element_alone); - - return *this; -} - -bool FirstLevelElement::operator ==( - const FirstLevelElement& x) const -{ - - return (m_useless_name == x.m_useless_name && m_sub == x.m_sub && m_an_element_alone == x.m_an_element_alone); -} - -bool FirstLevelElement::operator !=( - const FirstLevelElement& x) const -{ - return !(*this == x); -} - -size_t FirstLevelElement::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < 100; ++a) - { - current_alignment += SecondLevelElement::getMaxCdrSerializedSize(current_alignment);} - - current_alignment += ThirdLevelElement::getMaxCdrSerializedSize(current_alignment); - - return current_alignment - initial_alignment; -} - -size_t FirstLevelElement::getCdrSerializedSize( - const FirstLevelElement& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.useless_name().size() + 1; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.sub().size(); ++a) - { - current_alignment += SecondLevelElement::getCdrSerializedSize(data.sub().at(a), current_alignment);} - - current_alignment += ThirdLevelElement::getCdrSerializedSize(data.an_element_alone(), current_alignment); - - return current_alignment - initial_alignment; -} - -void FirstLevelElement::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_useless_name.c_str(); - scdr << m_sub; - scdr << m_an_element_alone; - -} - -void FirstLevelElement::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_useless_name; - dcdr >> m_sub; - dcdr >> m_an_element_alone; -} - -/*! - * @brief This function copies the value in member useless_name - * @param _useless_name New value to be copied in member useless_name - */ -void FirstLevelElement::useless_name( - const std::string& _useless_name) -{ - m_useless_name = _useless_name; -} - -/*! - * @brief This function moves the value in member useless_name - * @param _useless_name New value to be moved in member useless_name - */ -void FirstLevelElement::useless_name( - std::string&& _useless_name) -{ - m_useless_name = std::move(_useless_name); -} - -/*! - * @brief This function returns a constant reference to member useless_name - * @return Constant reference to member useless_name - */ -const std::string& FirstLevelElement::useless_name() const -{ - return m_useless_name; -} - -/*! - * @brief This function returns a reference to member useless_name - * @return Reference to member useless_name - */ -std::string& FirstLevelElement::useless_name() -{ - return m_useless_name; -} -/*! - * @brief This function copies the value in member sub - * @param _sub New value to be copied in member sub - */ -void FirstLevelElement::sub( - const std::vector& _sub) -{ - m_sub = _sub; -} - -/*! - * @brief This function moves the value in member sub - * @param _sub New value to be moved in member sub - */ -void FirstLevelElement::sub( - std::vector&& _sub) -{ - m_sub = std::move(_sub); -} - -/*! - * @brief This function returns a constant reference to member sub - * @return Constant reference to member sub - */ -const std::vector& FirstLevelElement::sub() const -{ - return m_sub; -} - -/*! - * @brief This function returns a reference to member sub - * @return Reference to member sub - */ -std::vector& FirstLevelElement::sub() -{ - return m_sub; -} -/*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ -void FirstLevelElement::an_element_alone( - const ThirdLevelElement& _an_element_alone) -{ - m_an_element_alone = _an_element_alone; -} - -/*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ -void FirstLevelElement::an_element_alone( - ThirdLevelElement&& _an_element_alone) -{ - m_an_element_alone = std::move(_an_element_alone); -} - -/*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ -const ThirdLevelElement& FirstLevelElement::an_element_alone() const -{ - return m_an_element_alone; -} - -/*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ -ThirdLevelElement& FirstLevelElement::an_element_alone() -{ - return m_an_element_alone; -} - -size_t FirstLevelElement::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - - return current_align; -} - -bool FirstLevelElement::isKeyDefined() -{ - return false; -} - -void FirstLevelElement::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} - -complex_nested_arrays::complex_nested_arrays() -{ - // m_array_of_elements com.eprosima.idl.parser.typecode.ArrayTypeCode@1fc2b765 - - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -complex_nested_arrays::~complex_nested_arrays() -{ -} - -complex_nested_arrays::complex_nested_arrays( - const complex_nested_arrays& x) -{ - m_array_of_elements = x.m_array_of_elements; -} - -complex_nested_arrays::complex_nested_arrays( - complex_nested_arrays&& x) noexcept -{ - m_array_of_elements = std::move(x.m_array_of_elements); -} - -complex_nested_arrays& complex_nested_arrays::operator =( - const complex_nested_arrays& x) -{ - - m_array_of_elements = x.m_array_of_elements; - - return *this; -} - -complex_nested_arrays& complex_nested_arrays::operator =( - complex_nested_arrays&& x) noexcept -{ - - m_array_of_elements = std::move(x.m_array_of_elements); - - return *this; -} - -bool complex_nested_arrays::operator ==( - const complex_nested_arrays& x) const -{ - - return (m_array_of_elements == x.m_array_of_elements); -} - -bool complex_nested_arrays::operator !=( - const complex_nested_arrays& x) const -{ - return !(*this == x); -} - -size_t complex_nested_arrays::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - - for(size_t a = 0; a < (3); ++a) - { - current_alignment += FirstLevelElement::getMaxCdrSerializedSize(current_alignment);} - return current_alignment - initial_alignment; -} - -size_t complex_nested_arrays::getCdrSerializedSize( - const complex_nested_arrays& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - - for(size_t a = 0; a < data.array_of_elements().size(); ++a) - { - current_alignment += FirstLevelElement::getCdrSerializedSize(data.array_of_elements().at(a), current_alignment); - } - return current_alignment - initial_alignment; -} - -void complex_nested_arrays::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_array_of_elements; - - -} - -void complex_nested_arrays::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_array_of_elements; - -} - -/*! - * @brief This function copies the value in member array_of_elements - * @param _array_of_elements New value to be copied in member array_of_elements - */ -void complex_nested_arrays::array_of_elements( - const std::array& _array_of_elements) -{ - m_array_of_elements = _array_of_elements; -} - -/*! - * @brief This function moves the value in member array_of_elements - * @param _array_of_elements New value to be moved in member array_of_elements - */ -void complex_nested_arrays::array_of_elements( - std::array&& _array_of_elements) -{ - m_array_of_elements = std::move(_array_of_elements); -} - -/*! - * @brief This function returns a constant reference to member array_of_elements - * @return Constant reference to member array_of_elements - */ -const std::array& complex_nested_arrays::array_of_elements() const -{ - return m_array_of_elements; -} - -/*! - * @brief This function returns a reference to member array_of_elements - * @return Reference to member array_of_elements - */ -std::array& complex_nested_arrays::array_of_elements() -{ - return m_array_of_elements; -} - -size_t complex_nested_arrays::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - return current_align; -} - -bool complex_nested_arrays::isKeyDefined() -{ - return false; -} - -void complex_nested_arrays::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.h deleted file mode 100644 index dd1b58ff..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arrays.h +++ /dev/null @@ -1,747 +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 complex_nested_arrays.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(complex_nested_arrays_SOURCE) -#define complex_nested_arrays_DllAPI __declspec( dllexport ) -#else -#define complex_nested_arrays_DllAPI __declspec( dllimport ) -#endif // complex_nested_arrays_SOURCE -#else -#define complex_nested_arrays_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define complex_nested_arrays_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure ThirdLevelElement defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class ThirdLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport ThirdLevelElement(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~ThirdLevelElement(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement( - const ThirdLevelElement& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement( - ThirdLevelElement&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement& operator =( - const ThirdLevelElement& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement& operator =( - ThirdLevelElement&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x ThirdLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const ThirdLevelElement& x) const; - - /*! - * @brief Comparison operator. - * @param x ThirdLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const ThirdLevelElement& x) const; - - /*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ - eProsima_user_DllExport void x( - double _x); - - /*! - * @brief This function returns the value of member x - * @return Value of member x - */ - eProsima_user_DllExport double x() const; - - /*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ - eProsima_user_DllExport double& x(); - - /*! - * @brief This function sets a value in member y - * @param _y New value for member y - */ - eProsima_user_DllExport void y( - double _y); - - /*! - * @brief This function returns the value of member y - * @return Value of member y - */ - eProsima_user_DllExport double y() const; - - /*! - * @brief This function returns a reference to member y - * @return Reference to member y - */ - eProsima_user_DllExport double& y(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const ThirdLevelElement& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - double m_x; - double m_y; -}; -/*! - * @brief This class represents the structure SecondLevelElement defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class SecondLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SecondLevelElement(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SecondLevelElement(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement( - const SecondLevelElement& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement( - SecondLevelElement&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement& operator =( - const SecondLevelElement& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement& operator =( - SecondLevelElement&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x SecondLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SecondLevelElement& x) const; - - /*! - * @brief Comparison operator. - * @param x SecondLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SecondLevelElement& x) const; - - /*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone); - - /*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone); - - /*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const; - - /*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone(); - /*! - * @brief This function copies the value in member a_limited_other_value - * @param _a_limited_other_value New value to be copied in member a_limited_other_value - */ - eProsima_user_DllExport void a_limited_other_value( - const std::vector& _a_limited_other_value); - - /*! - * @brief This function moves the value in member a_limited_other_value - * @param _a_limited_other_value New value to be moved in member a_limited_other_value - */ - eProsima_user_DllExport void a_limited_other_value( - std::vector&& _a_limited_other_value); - - /*! - * @brief This function returns a constant reference to member a_limited_other_value - * @return Constant reference to member a_limited_other_value - */ - eProsima_user_DllExport const std::vector& a_limited_other_value() const; - - /*! - * @brief This function returns a reference to member a_limited_other_value - * @return Reference to member a_limited_other_value - */ - eProsima_user_DllExport std::vector& a_limited_other_value(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const SecondLevelElement& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - ThirdLevelElement m_an_element_alone; - std::vector m_a_limited_other_value; -}; -/*! - * @brief This class represents the structure FirstLevelElement defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class FirstLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport FirstLevelElement(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~FirstLevelElement(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement( - const FirstLevelElement& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement( - FirstLevelElement&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement& operator =( - const FirstLevelElement& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement& operator =( - FirstLevelElement&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x FirstLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const FirstLevelElement& x) const; - - /*! - * @brief Comparison operator. - * @param x FirstLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const FirstLevelElement& x) const; - - /*! - * @brief This function copies the value in member useless_name - * @param _useless_name New value to be copied in member useless_name - */ - eProsima_user_DllExport void useless_name( - const std::string& _useless_name); - - /*! - * @brief This function moves the value in member useless_name - * @param _useless_name New value to be moved in member useless_name - */ - eProsima_user_DllExport void useless_name( - std::string&& _useless_name); - - /*! - * @brief This function returns a constant reference to member useless_name - * @return Constant reference to member useless_name - */ - eProsima_user_DllExport const std::string& useless_name() const; - - /*! - * @brief This function returns a reference to member useless_name - * @return Reference to member useless_name - */ - eProsima_user_DllExport std::string& useless_name(); - /*! - * @brief This function copies the value in member sub - * @param _sub New value to be copied in member sub - */ - eProsima_user_DllExport void sub( - const std::vector& _sub); - - /*! - * @brief This function moves the value in member sub - * @param _sub New value to be moved in member sub - */ - eProsima_user_DllExport void sub( - std::vector&& _sub); - - /*! - * @brief This function returns a constant reference to member sub - * @return Constant reference to member sub - */ - eProsima_user_DllExport const std::vector& sub() const; - - /*! - * @brief This function returns a reference to member sub - * @return Reference to member sub - */ - eProsima_user_DllExport std::vector& sub(); - /*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone); - - /*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone); - - /*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const; - - /*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const FirstLevelElement& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::string m_useless_name; - std::vector m_sub; - ThirdLevelElement m_an_element_alone; -}; -/*! - * @brief This class represents the structure complex_nested_arrays defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class complex_nested_arrays -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport complex_nested_arrays(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~complex_nested_arrays(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays( - const complex_nested_arrays& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays( - complex_nested_arrays&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays& operator =( - const complex_nested_arrays& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays& operator =( - complex_nested_arrays&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x complex_nested_arrays object to compare. - */ - eProsima_user_DllExport bool operator ==( - const complex_nested_arrays& x) const; - - /*! - * @brief Comparison operator. - * @param x complex_nested_arrays object to compare. - */ - eProsima_user_DllExport bool operator !=( - const complex_nested_arrays& x) const; - - /*! - * @brief This function copies the value in member array_of_elements - * @param _array_of_elements New value to be copied in member array_of_elements - */ - eProsima_user_DllExport void array_of_elements( - const std::array& _array_of_elements); - - /*! - * @brief This function moves the value in member array_of_elements - * @param _array_of_elements New value to be moved in member array_of_elements - */ - eProsima_user_DllExport void array_of_elements( - std::array&& _array_of_elements); - - /*! - * @brief This function returns a constant reference to member array_of_elements - * @return Constant reference to member array_of_elements - */ - eProsima_user_DllExport const std::array& array_of_elements() const; - - /*! - * @brief This function returns a reference to member array_of_elements - * @return Reference to member array_of_elements - */ - eProsima_user_DllExport std::array& array_of_elements(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const complex_nested_arrays& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::array m_array_of_elements; -}; - -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.cxx deleted file mode 100644 index 1b7c758f..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.cxx +++ /dev/null @@ -1,589 +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 complex_nested_arraysPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "complex_nested_arraysPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -ThirdLevelElementPubSubType::ThirdLevelElementPubSubType() -{ - setName("ThirdLevelElement"); - auto type_size = ThirdLevelElement::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = ThirdLevelElement::isKeyDefined(); - size_t keyLength = ThirdLevelElement::getKeyMaxCdrSerializedSize() > 16 ? - ThirdLevelElement::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -ThirdLevelElementPubSubType::~ThirdLevelElementPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool ThirdLevelElementPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - ThirdLevelElement* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool ThirdLevelElementPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - ThirdLevelElement* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function ThirdLevelElementPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* ThirdLevelElementPubSubType::createData() -{ - return reinterpret_cast(new ThirdLevelElement()); -} - -void ThirdLevelElementPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool ThirdLevelElementPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - ThirdLevelElement* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - ThirdLevelElement::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || ThirdLevelElement::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -SecondLevelElementPubSubType::SecondLevelElementPubSubType() -{ - setName("SecondLevelElement"); - auto type_size = SecondLevelElement::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = SecondLevelElement::isKeyDefined(); - size_t keyLength = SecondLevelElement::getKeyMaxCdrSerializedSize() > 16 ? - SecondLevelElement::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -SecondLevelElementPubSubType::~SecondLevelElementPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool SecondLevelElementPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - SecondLevelElement* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool SecondLevelElementPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - SecondLevelElement* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function SecondLevelElementPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* SecondLevelElementPubSubType::createData() -{ - return reinterpret_cast(new SecondLevelElement()); -} - -void SecondLevelElementPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool SecondLevelElementPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - SecondLevelElement* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - SecondLevelElement::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || SecondLevelElement::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -FirstLevelElementPubSubType::FirstLevelElementPubSubType() -{ - setName("FirstLevelElement"); - auto type_size = FirstLevelElement::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = FirstLevelElement::isKeyDefined(); - size_t keyLength = FirstLevelElement::getKeyMaxCdrSerializedSize() > 16 ? - FirstLevelElement::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -FirstLevelElementPubSubType::~FirstLevelElementPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool FirstLevelElementPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - FirstLevelElement* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool FirstLevelElementPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - FirstLevelElement* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function FirstLevelElementPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* FirstLevelElementPubSubType::createData() -{ - return reinterpret_cast(new FirstLevelElement()); -} - -void FirstLevelElementPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool FirstLevelElementPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - FirstLevelElement* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - FirstLevelElement::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || FirstLevelElement::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -complex_nested_arraysPubSubType::complex_nested_arraysPubSubType() -{ - setName("complex_nested_arrays"); - auto type_size = complex_nested_arrays::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = complex_nested_arrays::isKeyDefined(); - size_t keyLength = complex_nested_arrays::getKeyMaxCdrSerializedSize() > 16 ? - complex_nested_arrays::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -complex_nested_arraysPubSubType::~complex_nested_arraysPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool complex_nested_arraysPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - complex_nested_arrays* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool complex_nested_arraysPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - complex_nested_arrays* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function complex_nested_arraysPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* complex_nested_arraysPubSubType::createData() -{ - return reinterpret_cast(new complex_nested_arrays()); -} - -void complex_nested_arraysPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool complex_nested_arraysPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - complex_nested_arrays* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - complex_nested_arrays::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || complex_nested_arrays::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.h deleted file mode 100644 index 93e214af..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysPubSubTypes.h +++ /dev/null @@ -1,293 +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 complex_nested_arraysPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_H_ - -#include -#include - -#include "complex_nested_arrays.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated complex_nested_arrays is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type ThirdLevelElement defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef ThirdLevelElement type; - - eProsima_user_DllExport ThirdLevelElementPubSubType(); - - eProsima_user_DllExport virtual ~ThirdLevelElementPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) ThirdLevelElement(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; -/*! - * @brief This class represents the TopicDataType of the type SecondLevelElement defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef SecondLevelElement type; - - eProsima_user_DllExport SecondLevelElementPubSubType(); - - eProsima_user_DllExport virtual ~SecondLevelElementPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; -/*! - * @brief This class represents the TopicDataType of the type FirstLevelElement defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef FirstLevelElement type; - - eProsima_user_DllExport FirstLevelElementPubSubType(); - - eProsima_user_DllExport virtual ~FirstLevelElementPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; -/*! - * @brief This class represents the TopicDataType of the type complex_nested_arrays defined by the user in the IDL file. - * @ingroup COMPLEX_NESTED_ARRAYS - */ -class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef complex_nested_arrays type; - - eProsima_user_DllExport complex_nested_arraysPubSubType(); - - eProsima_user_DllExport virtual ~complex_nested_arraysPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.cxx deleted file mode 100644 index 2862811e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.cxx +++ /dev/null @@ -1,856 +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 complex_nested_arraysTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "complex_nested_arrays.h" -#include "complex_nested_arraysTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registercomplex_nested_arraysTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("ThirdLevelElement", GetThirdLevelElementIdentifier(true), - GetThirdLevelElementObject(true)); - factory->add_type_object("ThirdLevelElement", GetThirdLevelElementIdentifier(false), - GetThirdLevelElementObject(false)); - - factory->add_type_object("SecondLevelElement", GetSecondLevelElementIdentifier(true), - GetSecondLevelElementObject(true)); - factory->add_type_object("SecondLevelElement", GetSecondLevelElementIdentifier(false), - GetSecondLevelElementObject(false)); - - factory->add_type_object("FirstLevelElement", GetFirstLevelElementIdentifier(true), - GetFirstLevelElementObject(true)); - factory->add_type_object("FirstLevelElement", GetFirstLevelElementIdentifier(false), - GetFirstLevelElementObject(false)); - - factory->add_type_object("complex_nested_arrays", Getcomplex_nested_arraysIdentifier(true), - Getcomplex_nested_arraysObject(true)); - factory->add_type_object("complex_nested_arrays", Getcomplex_nested_arraysIdentifier(false), - Getcomplex_nested_arraysObject(false)); - -} - -const TypeIdentifier* GetThirdLevelElementIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("ThirdLevelElement", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetThirdLevelElementObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("ThirdLevelElement", complete); -} - -const TypeObject* GetThirdLevelElementObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteThirdLevelElementObject(); - } - //else - return GetMinimalThirdLevelElementObject(); -} - -const TypeObject* GetMinimalThirdLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_x; - mst_x.common().member_id(memberId++); - mst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_x.common().member_flags().IS_OPTIONAL(false); - mst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_x.common().member_flags().IS_KEY(false); - mst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - MD5 x_hash("x"); - for(int i = 0; i < 4; ++i) - { - mst_x.detail().name_hash()[i] = x_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_x); - - MinimalStructMember mst_y; - mst_y.common().member_id(memberId++); - mst_y.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_y.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_y.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_y.common().member_flags().IS_OPTIONAL(false); - mst_y.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_y.common().member_flags().IS_KEY(false); - mst_y.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_y.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - MD5 y_hash("y"); - for(int i = 0; i < 4; ++i) - { - mst_y.detail().name_hash()[i] = y_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_y); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ThirdLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", false); -} - -const TypeObject* GetCompleteThirdLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_x; - cst_x.common().member_id(memberId++); - cst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_x.common().member_flags().IS_OPTIONAL(false); - cst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_x.common().member_flags().IS_KEY(false); - cst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - cst_x.detail().name("x"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_x); - - CompleteStructMember cst_y; - cst_y.common().member_id(memberId++); - cst_y.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_y.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_y.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_y.common().member_flags().IS_OPTIONAL(false); - cst_y.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_y.common().member_flags().IS_KEY(false); - cst_y.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_y.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - cst_y.detail().name("y"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_y); - - - // Header - type_object->complete().struct_type().header().detail().type_name("ThirdLevelElement"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ThirdLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", true); -} - -const TypeIdentifier* GetSecondLevelElementIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("SecondLevelElement", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetSecondLevelElementObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("SecondLevelElement", complete); -} - -const TypeObject* GetSecondLevelElementObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteSecondLevelElementObject(); - } - //else - return GetMinimalSecondLevelElementObject(); -} - -const TypeObject* GetMinimalSecondLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_an_element_alone; - mst_an_element_alone.common().member_id(memberId++); - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - mst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_an_element_alone.common().member_flags().IS_KEY(false); - mst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(false)); - MD5 an_element_alone_hash("an_element_alone"); - for(int i = 0; i < 4; ++i) - { - mst_an_element_alone.detail().name_hash()[i] = an_element_alone_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_an_element_alone); - - MinimalStructMember mst_a_limited_other_value; - mst_a_limited_other_value.common().member_id(memberId++); - mst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_a_limited_other_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_a_limited_other_value.common().member_flags().IS_OPTIONAL(false); - mst_a_limited_other_value.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_a_limited_other_value.common().member_flags().IS_KEY(false); - mst_a_limited_other_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_a_limited_other_value.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("ThirdLevelElement", 1, false)); - - - MD5 a_limited_other_value_hash("a_limited_other_value"); - for(int i = 0; i < 4; ++i) - { - mst_a_limited_other_value.detail().name_hash()[i] = a_limited_other_value_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_a_limited_other_value); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("SecondLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", false); -} - -const TypeObject* GetCompleteSecondLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_an_element_alone; - cst_an_element_alone.common().member_id(memberId++); - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - cst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_an_element_alone.common().member_flags().IS_KEY(false); - cst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(true)); - cst_an_element_alone.detail().name("an_element_alone"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_an_element_alone); - - CompleteStructMember cst_a_limited_other_value; - cst_a_limited_other_value.common().member_id(memberId++); - cst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_a_limited_other_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_a_limited_other_value.common().member_flags().IS_OPTIONAL(false); - cst_a_limited_other_value.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_a_limited_other_value.common().member_flags().IS_KEY(false); - cst_a_limited_other_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_a_limited_other_value.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("ThirdLevelElement", 1, true)); - - - cst_a_limited_other_value.detail().name("a_limited_other_value"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_a_limited_other_value); - - - // Header - type_object->complete().struct_type().header().detail().type_name("SecondLevelElement"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("SecondLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", true); -} - -const TypeIdentifier* GetFirstLevelElementIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("FirstLevelElement", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetFirstLevelElementObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("FirstLevelElement", complete); -} - -const TypeObject* GetFirstLevelElementObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteFirstLevelElementObject(); - } - //else - return GetMinimalFirstLevelElementObject(); -} - -const TypeObject* GetMinimalFirstLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_useless_name; - mst_useless_name.common().member_id(memberId++); - mst_useless_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_useless_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_useless_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_useless_name.common().member_flags().IS_OPTIONAL(false); - mst_useless_name.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_useless_name.common().member_flags().IS_KEY(false); - mst_useless_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_useless_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - - MD5 useless_name_hash("useless_name"); - for(int i = 0; i < 4; ++i) - { - mst_useless_name.detail().name_hash()[i] = useless_name_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_useless_name); - - MinimalStructMember mst_sub; - mst_sub.common().member_id(memberId++); - mst_sub.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_sub.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_sub.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_sub.common().member_flags().IS_OPTIONAL(false); - mst_sub.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_sub.common().member_flags().IS_KEY(false); - mst_sub.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_sub.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("SecondLevelElement", 0, false)); - - - MD5 sub_hash("sub"); - for(int i = 0; i < 4; ++i) - { - mst_sub.detail().name_hash()[i] = sub_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_sub); - - MinimalStructMember mst_an_element_alone; - mst_an_element_alone.common().member_id(memberId++); - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - mst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_an_element_alone.common().member_flags().IS_KEY(false); - mst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(false)); - MD5 an_element_alone_hash("an_element_alone"); - for(int i = 0; i < 4; ++i) - { - mst_an_element_alone.detail().name_hash()[i] = an_element_alone_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_an_element_alone); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("FirstLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", false); -} - -const TypeObject* GetCompleteFirstLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_useless_name; - cst_useless_name.common().member_id(memberId++); - cst_useless_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_useless_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_useless_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_useless_name.common().member_flags().IS_OPTIONAL(false); - cst_useless_name.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_useless_name.common().member_flags().IS_KEY(false); - cst_useless_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_useless_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - - cst_useless_name.detail().name("useless_name"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_useless_name); - - CompleteStructMember cst_sub; - cst_sub.common().member_id(memberId++); - cst_sub.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_sub.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_sub.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_sub.common().member_flags().IS_OPTIONAL(false); - cst_sub.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_sub.common().member_flags().IS_KEY(false); - cst_sub.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_sub.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("SecondLevelElement", 0, true)); - - - cst_sub.detail().name("sub"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_sub); - - CompleteStructMember cst_an_element_alone; - cst_an_element_alone.common().member_id(memberId++); - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - cst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_an_element_alone.common().member_flags().IS_KEY(false); - cst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(true)); - cst_an_element_alone.detail().name("an_element_alone"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_an_element_alone); - - - // Header - type_object->complete().struct_type().header().detail().type_name("FirstLevelElement"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("FirstLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", true); -} - -const TypeIdentifier* Getcomplex_nested_arraysIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("complex_nested_arrays", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getcomplex_nested_arraysObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("complex_nested_arrays", complete); -} - -const TypeObject* Getcomplex_nested_arraysObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletecomplex_nested_arraysObject(); - } - //else - return GetMinimalcomplex_nested_arraysObject(); -} - -const TypeObject* GetMinimalcomplex_nested_arraysObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_array_of_elements; - mst_array_of_elements.common().member_id(memberId++); - mst_array_of_elements.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_array_of_elements.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_array_of_elements.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_array_of_elements.common().member_flags().IS_OPTIONAL(false); - mst_array_of_elements.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_array_of_elements.common().member_flags().IS_KEY(false); - mst_array_of_elements.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_array_of_elements.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("FirstLevelElement", {3}, false)); - - - MD5 array_of_elements_hash("array_of_elements"); - for(int i = 0; i < 4; ++i) - { - mst_array_of_elements.detail().name_hash()[i] = array_of_elements_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_array_of_elements); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("complex_nested_arrays", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", false); -} - -const TypeObject* GetCompletecomplex_nested_arraysObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_array_of_elements; - cst_array_of_elements.common().member_id(memberId++); - cst_array_of_elements.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_array_of_elements.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_array_of_elements.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_array_of_elements.common().member_flags().IS_OPTIONAL(false); - cst_array_of_elements.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_array_of_elements.common().member_flags().IS_KEY(false); - cst_array_of_elements.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_array_of_elements.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("FirstLevelElement", {3}, true)); - - - cst_array_of_elements.detail().name("array_of_elements"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_array_of_elements); - - - // Header - type_object->complete().struct_type().header().detail().type_name("complex_nested_arrays"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("complex_nested_arrays", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.h deleted file mode 100644 index 6f071275..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/complex_nested_arraysTypeObject.h +++ /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 complex_nested_arraysTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(complex_nested_arrays_SOURCE) -#define complex_nested_arrays_DllAPI __declspec( dllexport ) -#else -#define complex_nested_arrays_DllAPI __declspec( dllimport ) -#endif // complex_nested_arrays_SOURCE -#else -#define complex_nested_arrays_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define complex_nested_arrays_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registercomplex_nested_arraysTypes(); - -eProsima_user_DllExport const TypeIdentifier* GetThirdLevelElementIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetThirdLevelElementObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalThirdLevelElementObject(); -eProsima_user_DllExport const TypeObject* GetCompleteThirdLevelElementObject(); - -eProsima_user_DllExport const TypeIdentifier* GetSecondLevelElementIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetSecondLevelElementObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalSecondLevelElementObject(); -eProsima_user_DllExport const TypeObject* GetCompleteSecondLevelElementObject(); - -eProsima_user_DllExport const TypeIdentifier* GetFirstLevelElementIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetFirstLevelElementObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalFirstLevelElementObject(); -eProsima_user_DllExport const TypeObject* GetCompleteFirstLevelElementObject(); - -eProsima_user_DllExport const TypeIdentifier* Getcomplex_nested_arraysIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Getcomplex_nested_arraysObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalcomplex_nested_arraysObject(); -eProsima_user_DllExport const TypeObject* GetCompletecomplex_nested_arraysObject(); - - -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.cxx deleted file mode 100644 index 92a88b0a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.cxx +++ /dev/null @@ -1,229 +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 enum_struct.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "enum_struct.h" -#include "enum_structTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -#define enum_struct_max_cdr_typesize 8ULL; - -#define enum_struct_max_key_cdr_typesize 0ULL; - - - -enum_struct::enum_struct() -{ - // unsigned long m_index - m_index = 0; - // ColorEnum m_enum_value - m_enum_value = ::RED; - - // Just to register all known types - registerenum_structTypes(); -} - -enum_struct::~enum_struct() -{ - - -} - -enum_struct::enum_struct( - const enum_struct& x) -{ - m_index = x.m_index; - m_enum_value = x.m_enum_value; -} - -enum_struct::enum_struct( - enum_struct&& x) noexcept -{ - m_index = x.m_index; - m_enum_value = x.m_enum_value; -} - -enum_struct& enum_struct::operator =( - const enum_struct& x) -{ - - m_index = x.m_index; - m_enum_value = x.m_enum_value; - - return *this; -} - -enum_struct& enum_struct::operator =( - enum_struct&& x) noexcept -{ - - m_index = x.m_index; - m_enum_value = x.m_enum_value; - - return *this; -} - -bool enum_struct::operator ==( - const enum_struct& x) const -{ - - return (m_index == x.m_index && m_enum_value == x.m_enum_value); -} - -bool enum_struct::operator !=( - const enum_struct& x) const -{ - return !(*this == x); -} - -size_t enum_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return enum_struct_max_cdr_typesize; -} - -size_t enum_struct::getCdrSerializedSize( - const enum_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - return current_alignment - initial_alignment; -} - -void enum_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_index; - scdr << (uint32_t)m_enum_value; - -} - -void enum_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_index; - { - uint32_t enum_value = 0; - dcdr >> enum_value; - m_enum_value = (ColorEnum)enum_value; - } - -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void enum_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t enum_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& enum_struct::index() -{ - return m_index; -} - -/*! - * @brief This function sets a value in member enum_value - * @param _enum_value New value for member enum_value - */ -void enum_struct::enum_value( - ColorEnum _enum_value) -{ - m_enum_value = _enum_value; -} - -/*! - * @brief This function returns the value of member enum_value - * @return Value of member enum_value - */ -ColorEnum enum_struct::enum_value() const -{ - return m_enum_value; -} - -/*! - * @brief This function returns a reference to member enum_value - * @return Reference to member enum_value - */ -ColorEnum& enum_struct::enum_value() -{ - return m_enum_value; -} - - - -size_t enum_struct::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return enum_struct_max_key_cdr_typesize; -} - -bool enum_struct::isKeyDefined() -{ - return false; -} - -void enum_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.h deleted file mode 100644 index 1c0a770d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_struct.h +++ /dev/null @@ -1,239 +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 enum_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_H_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(ENUM_STRUCT_SOURCE) -#define ENUM_STRUCT_DllAPI __declspec( dllexport ) -#else -#define ENUM_STRUCT_DllAPI __declspec( dllimport ) -#endif // ENUM_STRUCT_SOURCE -#else -#define ENUM_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define ENUM_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the enumeration ColorEnum defined by the user in the IDL file. - * @ingroup enum_struct - */ -enum ColorEnum : uint32_t -{ - RED, - GREEN, - BLUE -}; -/*! - * @brief This class represents the structure enum_struct defined by the user in the IDL file. - * @ingroup enum_struct - */ -class enum_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport enum_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~enum_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct( - const enum_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct( - enum_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct& operator =( - const enum_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct& operator =( - enum_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x enum_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const enum_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x enum_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const enum_struct& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - /*! - * @brief This function sets a value in member enum_value - * @param _enum_value New value for member enum_value - */ - eProsima_user_DllExport void enum_value( - ColorEnum _enum_value); - - /*! - * @brief This function returns the value of member enum_value - * @return Value of member enum_value - */ - eProsima_user_DllExport ColorEnum enum_value() const; - - /*! - * @brief This function returns a reference to member enum_value - * @return Reference to member enum_value - */ - eProsima_user_DllExport ColorEnum& enum_value(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const enum_struct& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - uint32_t m_index; - ColorEnum m_enum_value; - -}; - -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.cxx deleted file mode 100644 index e93d8f5d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.cxx +++ /dev/null @@ -1,170 +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 enum_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "enum_structPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - - -enum_structPubSubType::enum_structPubSubType() -{ - setName("enum_struct"); - auto type_size = enum_struct::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = enum_struct::isKeyDefined(); - size_t keyLength = enum_struct::getKeyMaxCdrSerializedSize() > 16 ? - enum_struct::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -enum_structPubSubType::~enum_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool enum_structPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - enum_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool enum_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - enum_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; -} - -std::function enum_structPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* enum_structPubSubType::createData() -{ - return reinterpret_cast(new enum_struct()); -} - -void enum_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool enum_structPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - enum_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - enum_struct::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || enum_struct::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.h deleted file mode 100644 index f85486a8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structPubSubTypes.h +++ /dev/null @@ -1,105 +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 enum_structPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_PUBSUBTYPES_H_ - -#include -#include - -#include "enum_struct.h" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated enum_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - - -/*! - * @brief This class represents the TopicDataType of the type enum_struct defined by the user in the IDL file. - * @ingroup enum_struct - */ -class enum_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef enum_struct type; - - eProsima_user_DllExport enum_structPubSubType(); - - eProsima_user_DllExport virtual ~enum_structPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.cxx deleted file mode 100644 index 109026e6..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.cxx +++ /dev/null @@ -1,470 +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 enum_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "enum_struct.h" -#include "enum_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerenum_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("ColorEnum", GetColorEnumIdentifier(true), - GetColorEnumObject(true)); - factory->add_type_object("ColorEnum", GetColorEnumIdentifier(false), - GetColorEnumObject(false)); - - factory->add_type_object("enum_struct", Getenum_structIdentifier(true), - Getenum_structObject(true)); - factory->add_type_object("enum_struct", Getenum_structIdentifier(false), - Getenum_structObject(false)); - - }); -} - -const TypeIdentifier* GetColorEnumIdentifier(bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("ColorEnum", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetColorEnumObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("ColorEnum", complete); -} - -const TypeObject* GetColorEnumObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ColorEnum", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteColorEnumObject(); - } - // else - return GetMinimalColorEnumObject(); -} - -const TypeObject* GetMinimalColorEnumObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ColorEnum", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_ENUM); - - // No flags apply - //type_object->minimal().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->minimal().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->minimal().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->minimal().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - - uint32_t value = 0; - MinimalEnumeratedLiteral mel_RED; - mel_RED.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_RED.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_RED.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_RED.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_RED.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_RED.common().flags().IS_KEY(false); // Doesn't apply - mel_RED.common().flags().IS_DEFAULT(false); - mel_RED.common().value(value++); - MD5 RED_hash("RED"); - for(int i = 0; i < 4; ++i) - { - mel_RED.detail().name_hash()[i] = RED_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_RED); - - MinimalEnumeratedLiteral mel_GREEN; - mel_GREEN.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_GREEN.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_GREEN.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_GREEN.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_GREEN.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_GREEN.common().flags().IS_KEY(false); // Doesn't apply - mel_GREEN.common().flags().IS_DEFAULT(false); - mel_GREEN.common().value(value++); - MD5 GREEN_hash("GREEN"); - for(int i = 0; i < 4; ++i) - { - mel_GREEN.detail().name_hash()[i] = GREEN_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_GREEN); - - MinimalEnumeratedLiteral mel_BLUE; - mel_BLUE.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_BLUE.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_BLUE.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_BLUE.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_BLUE.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_BLUE.common().flags().IS_KEY(false); // Doesn't apply - mel_BLUE.common().flags().IS_DEFAULT(false); - mel_BLUE.common().value(value++); - MD5 BLUE_hash("BLUE"); - for(int i = 0; i < 4; ++i) - { - mel_BLUE.detail().name_hash()[i] = BLUE_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_BLUE); - - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalEnumeratedType::getCdrSerializedSize(type_object->minimal().enumerated_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ColorEnum", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ColorEnum", false); -} - -const TypeObject* GetCompleteColorEnumObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ColorEnum", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_ENUM); - - // No flags apply - //type_object->complete().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->complete().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->complete().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->complete().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - type_object->complete().enumerated_type().header().detail().type_name("ColorEnum"); - - - uint32_t value = 0; - CompleteEnumeratedLiteral cel_RED; - cel_RED.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_RED.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_RED.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_RED.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_RED.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_RED.common().flags().IS_KEY(false); // Doesn't apply - cel_RED.common().flags().IS_DEFAULT(false); - cel_RED.common().value(value++); - cel_RED.detail().name("RED"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_RED); - - CompleteEnumeratedLiteral cel_GREEN; - cel_GREEN.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_GREEN.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_GREEN.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_GREEN.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_GREEN.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_GREEN.common().flags().IS_KEY(false); // Doesn't apply - cel_GREEN.common().flags().IS_DEFAULT(false); - cel_GREEN.common().value(value++); - cel_GREEN.detail().name("GREEN"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_GREEN); - - CompleteEnumeratedLiteral cel_BLUE; - cel_BLUE.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_BLUE.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_BLUE.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_BLUE.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_BLUE.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_BLUE.common().flags().IS_KEY(false); // Doesn't apply - cel_BLUE.common().flags().IS_DEFAULT(false); - cel_BLUE.common().value(value++); - cel_BLUE.detail().name("BLUE"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_BLUE); - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteEnumeratedType::getCdrSerializedSize(type_object->complete().enumerated_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ColorEnum", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ColorEnum", true); -} - -const TypeIdentifier* Getenum_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("enum_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getenum_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("enum_struct", complete); -} - -const TypeObject* Getenum_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("enum_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteenum_structObject(); - } - //else - return GetMinimalenum_structObject(); -} - -const TypeObject* GetMinimalenum_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("enum_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_enum_value; - mst_enum_value.common().member_id(memberId++); - mst_enum_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_enum_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_enum_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_enum_value.common().member_flags().IS_OPTIONAL(false); - mst_enum_value.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_enum_value.common().member_flags().IS_KEY(false); - mst_enum_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_enum_value.common().member_type_id(*GetColorEnumIdentifier(false)); - MD5 enum_value_hash("enum_value"); - for(int i = 0; i < 4; ++i) - { - mst_enum_value.detail().name_hash()[i] = enum_value_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_enum_value); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("enum_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("enum_struct", false); -} - -const TypeObject* GetCompleteenum_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("enum_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_enum_value; - cst_enum_value.common().member_id(memberId++); - cst_enum_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_enum_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_enum_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_enum_value.common().member_flags().IS_OPTIONAL(false); - cst_enum_value.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_enum_value.common().member_flags().IS_KEY(false); - cst_enum_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_enum_value.common().member_type_id(*GetColorEnumIdentifier(true)); - cst_enum_value.detail().name("enum_value"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_enum_value); - - - // Header - type_object->complete().struct_type().header().detail().type_name("enum_struct"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("enum_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("enum_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.h deleted file mode 100644 index ab841f64..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/enum_structTypeObject.h +++ /dev/null @@ -1,68 +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 enum_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(enum_struct_SOURCE) -#define enum_struct_DllAPI __declspec( dllexport ) -#else -#define enum_struct_DllAPI __declspec( dllimport ) -#endif // enum_struct_SOURCE -#else -#define enum_struct_DllAPI -#endif -#else -#define enum_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerenum_structTypes(); - -eProsima_user_DllExport const TypeIdentifier* GetColorEnumIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetColorEnumObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalColorEnumObject(); -eProsima_user_DllExport const TypeObject* GetCompleteColorEnumObject(); - -eProsima_user_DllExport const TypeIdentifier* Getenum_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getenum_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalenum_structObject(); -eProsima_user_DllExport const TypeObject* GetCompleteenum_structObject(); - - -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.cxx deleted file mode 100644 index 7179606c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.cxx +++ /dev/null @@ -1,200 +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 float_bounded_sequence.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "float_bounded_sequence.h" -#include "float_bounded_sequenceTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -float_bounded_sequence::float_bounded_sequence() -{ - // m_numbers com.eprosima.idl.parser.typecode.SequenceTypeCode@3fd7a715 - - - // Just to register all known types - registerfloat_bounded_sequenceTypes(); -} - -float_bounded_sequence::~float_bounded_sequence() -{ -} - -float_bounded_sequence::float_bounded_sequence( - const float_bounded_sequence& x) -{ - m_numbers = x.m_numbers; -} - -float_bounded_sequence::float_bounded_sequence( - float_bounded_sequence&& x) noexcept -{ - m_numbers = std::move(x.m_numbers); -} - -float_bounded_sequence& float_bounded_sequence::operator =( - const float_bounded_sequence& x) -{ - - m_numbers = x.m_numbers; - - return *this; -} - -float_bounded_sequence& float_bounded_sequence::operator =( - float_bounded_sequence&& x) noexcept -{ - - m_numbers = std::move(x.m_numbers); - - return *this; -} - -bool float_bounded_sequence::operator ==( - const float_bounded_sequence& x) const -{ - - return (m_numbers == x.m_numbers); -} - -bool float_bounded_sequence::operator !=( - const float_bounded_sequence& x) const -{ - return !(*this == x); -} - -size_t float_bounded_sequence::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - current_alignment += (13 * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - return current_alignment - initial_alignment; -} - -size_t float_bounded_sequence::getCdrSerializedSize( - const float_bounded_sequence& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - if (data.numbers().size() > 0) - { - current_alignment += (data.numbers().size() * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - } - - - - return current_alignment - initial_alignment; -} - -void float_bounded_sequence::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_numbers; -} - -void float_bounded_sequence::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_numbers;} - -/*! - * @brief This function copies the value in member numbers - * @param _numbers New value to be copied in member numbers - */ -void float_bounded_sequence::numbers( - const std::vector& _numbers) -{ - m_numbers = _numbers; -} - -/*! - * @brief This function moves the value in member numbers - * @param _numbers New value to be moved in member numbers - */ -void float_bounded_sequence::numbers( - std::vector&& _numbers) -{ - m_numbers = std::move(_numbers); -} - -/*! - * @brief This function returns a constant reference to member numbers - * @return Constant reference to member numbers - */ -const std::vector& float_bounded_sequence::numbers() const -{ - return m_numbers; -} - -/*! - * @brief This function returns a reference to member numbers - * @return Reference to member numbers - */ -std::vector& float_bounded_sequence::numbers() -{ - return m_numbers; -} - -size_t float_bounded_sequence::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - return current_align; -} - -bool float_bounded_sequence::isKeyDefined() -{ - return false; -} - -void float_bounded_sequence::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.h deleted file mode 100644 index b25178db..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequence.h +++ /dev/null @@ -1,214 +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 float_bounded_sequence.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(float_bounded_sequence_SOURCE) -#define float_bounded_sequence_DllAPI __declspec( dllexport ) -#else -#define float_bounded_sequence_DllAPI __declspec( dllimport ) -#endif // float_bounded_sequence_SOURCE -#else -#define float_bounded_sequence_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define float_bounded_sequence_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure float_bounded_sequence defined by the user in the IDL file. - * @ingroup FLOAT_BOUNDED_SEQUENCE - */ -class float_bounded_sequence -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport float_bounded_sequence(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~float_bounded_sequence(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence( - const float_bounded_sequence& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence( - float_bounded_sequence&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence& operator =( - const float_bounded_sequence& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence& operator =( - float_bounded_sequence&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x float_bounded_sequence object to compare. - */ - eProsima_user_DllExport bool operator ==( - const float_bounded_sequence& x) const; - - /*! - * @brief Comparison operator. - * @param x float_bounded_sequence object to compare. - */ - eProsima_user_DllExport bool operator !=( - const float_bounded_sequence& x) const; - - /*! - * @brief This function copies the value in member numbers - * @param _numbers New value to be copied in member numbers - */ - eProsima_user_DllExport void numbers( - const std::vector& _numbers); - - /*! - * @brief This function moves the value in member numbers - * @param _numbers New value to be moved in member numbers - */ - eProsima_user_DllExport void numbers( - std::vector&& _numbers); - - /*! - * @brief This function returns a constant reference to member numbers - * @return Constant reference to member numbers - */ - eProsima_user_DllExport const std::vector& numbers() const; - - /*! - * @brief This function returns a reference to member numbers - * @return Reference to member numbers - */ - eProsima_user_DllExport std::vector& numbers(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const float_bounded_sequence& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::vector m_numbers; -}; - -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.cxx deleted file mode 100644 index e0176475..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.cxx +++ /dev/null @@ -1,169 +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 float_bounded_sequencePubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "float_bounded_sequencePubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -float_bounded_sequencePubSubType::float_bounded_sequencePubSubType() -{ - setName("float_bounded_sequence"); - auto type_size = float_bounded_sequence::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = float_bounded_sequence::isKeyDefined(); - size_t keyLength = float_bounded_sequence::getKeyMaxCdrSerializedSize() > 16 ? - float_bounded_sequence::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -float_bounded_sequencePubSubType::~float_bounded_sequencePubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool float_bounded_sequencePubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - float_bounded_sequence* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool float_bounded_sequencePubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - float_bounded_sequence* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function float_bounded_sequencePubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* float_bounded_sequencePubSubType::createData() -{ - return reinterpret_cast(new float_bounded_sequence()); -} - -void float_bounded_sequencePubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool float_bounded_sequencePubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - float_bounded_sequence* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - float_bounded_sequence::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || float_bounded_sequence::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.h deleted file mode 100644 index 80661b58..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequencePubSubTypes.h +++ /dev/null @@ -1,101 +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 float_bounded_sequencePubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_H_ - -#include -#include - -#include "float_bounded_sequence.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated float_bounded_sequence is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type float_bounded_sequence defined by the user in the IDL file. - * @ingroup FLOAT_BOUNDED_SEQUENCE - */ -class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef float_bounded_sequence type; - - eProsima_user_DllExport float_bounded_sequencePubSubType(); - - eProsima_user_DllExport virtual ~float_bounded_sequencePubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.cxx deleted file mode 100644 index a329d1c0..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.cxx +++ /dev/null @@ -1,215 +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 float_bounded_sequenceTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "float_bounded_sequence.h" -#include "float_bounded_sequenceTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerfloat_bounded_sequenceTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("float_bounded_sequence", Getfloat_bounded_sequenceIdentifier(true), - Getfloat_bounded_sequenceObject(true)); - factory->add_type_object("float_bounded_sequence", Getfloat_bounded_sequenceIdentifier(false), - Getfloat_bounded_sequenceObject(false)); - -} - -const TypeIdentifier* Getfloat_bounded_sequenceIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("float_bounded_sequence", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getfloat_bounded_sequenceObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("float_bounded_sequence", complete); -} - -const TypeObject* Getfloat_bounded_sequenceObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletefloat_bounded_sequenceObject(); - } - //else - return GetMinimalfloat_bounded_sequenceObject(); -} - -const TypeObject* GetMinimalfloat_bounded_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_numbers; - mst_numbers.common().member_id(memberId++); - mst_numbers.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_numbers.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_numbers.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_numbers.common().member_flags().IS_OPTIONAL(false); - mst_numbers.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_numbers.common().member_flags().IS_KEY(false); - mst_numbers.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_numbers.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("float", 13, false)); - - - MD5 numbers_hash("numbers"); - for(int i = 0; i < 4; ++i) - { - mst_numbers.detail().name_hash()[i] = numbers_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_numbers); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("float_bounded_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", false); -} - -const TypeObject* GetCompletefloat_bounded_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_numbers; - cst_numbers.common().member_id(memberId++); - cst_numbers.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_numbers.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_numbers.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_numbers.common().member_flags().IS_OPTIONAL(false); - cst_numbers.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_numbers.common().member_flags().IS_KEY(false); - cst_numbers.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_numbers.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("float", 13, true)); - - - cst_numbers.detail().name("numbers"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_numbers); - - - // Header - type_object->complete().struct_type().header().detail().type_name("float_bounded_sequence"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("float_bounded_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.h deleted file mode 100644 index 65d62243..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/float_bounded_sequenceTypeObject.h +++ /dev/null @@ -1,65 +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 float_bounded_sequenceTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(float_bounded_sequence_SOURCE) -#define float_bounded_sequence_DllAPI __declspec( dllexport ) -#else -#define float_bounded_sequence_DllAPI __declspec( dllimport ) -#endif // float_bounded_sequence_SOURCE -#else -#define float_bounded_sequence_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define float_bounded_sequence_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerfloat_bounded_sequenceTypes(); - -eProsima_user_DllExport const TypeIdentifier* Getfloat_bounded_sequenceIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Getfloat_bounded_sequenceObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalfloat_bounded_sequenceObject(); -eProsima_user_DllExport const TypeObject* GetCompletefloat_bounded_sequenceObject(); - - -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.cxx deleted file mode 100644 index 40a12463..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.cxx +++ /dev/null @@ -1,239 +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 hello_world.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "hello_world.h" -#include "hello_worldTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -hello_world::hello_world() -{ - // m_index com.eprosima.idl.parser.typecode.PrimitiveTypeCode@1dfe2924 - m_index = 0; - // m_message com.eprosima.idl.parser.typecode.StringTypeCode@6ebc05a6 - m_message =""; - - // Just to register all known types - registerhello_worldTypes(); -} - -hello_world::~hello_world() -{ - - -} - -hello_world::hello_world( - const hello_world& x) -{ - m_index = x.m_index; - m_message = x.m_message; -} - -hello_world::hello_world( - hello_world&& x) noexcept -{ - m_index = x.m_index; - m_message = std::move(x.m_message); -} - -hello_world& hello_world::operator =( - const hello_world& x) -{ - - m_index = x.m_index; - m_message = x.m_message; - - return *this; -} - -hello_world& hello_world::operator =( - hello_world&& x) noexcept -{ - - m_index = x.m_index; - m_message = std::move(x.m_message); - - return *this; -} - -bool hello_world::operator ==( - const hello_world& x) const -{ - - return (m_index == x.m_index && m_message == x.m_message); -} - -bool hello_world::operator !=( - const hello_world& x) const -{ - return !(*this == x); -} - -size_t hello_world::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; - - - return current_alignment - initial_alignment; -} - -size_t hello_world::getCdrSerializedSize( - const hello_world& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1; - - - return current_alignment - initial_alignment; -} - -void hello_world::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_index; - scdr << m_message.c_str(); - -} - -void hello_world::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_index; - dcdr >> m_message; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void hello_world::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t hello_world::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& hello_world::index() -{ - return m_index; -} - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void hello_world::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void hello_world::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& hello_world::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& hello_world::message() -{ - return m_message; -} - -size_t hello_world::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - - - return current_align; -} - -bool hello_world::isKeyDefined() -{ - return false; -} - -void hello_world::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.h deleted file mode 100644 index 678a59f0..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_world.h +++ /dev/null @@ -1,234 +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 hello_world.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_H_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(hello_world_SOURCE) -#define hello_world_DllAPI __declspec( dllexport ) -#else -#define hello_world_DllAPI __declspec( dllimport ) -#endif // hello_world_SOURCE -#else -#define hello_world_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define hello_world_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure hello_world defined by the user in the IDL file. - * @ingroup HELLO_WORLD - */ -class hello_world -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport hello_world(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~hello_world(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world( - const hello_world& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world( - hello_world&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world& operator =( - const hello_world& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world& operator =( - hello_world&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x hello_world object to compare. - */ - eProsima_user_DllExport bool operator ==( - const hello_world& x) const; - - /*! - * @brief Comparison operator. - * @param x hello_world object to compare. - */ - eProsima_user_DllExport bool operator !=( - const hello_world& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::string& _message); - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::string&& _message); - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::string& message() const; - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::string& message(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const hello_world& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - uint32_t m_index; - std::string m_message; -}; - -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.cxx deleted file mode 100644 index 8717497c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.cxx +++ /dev/null @@ -1,169 +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 hello_worldPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "hello_worldPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -hello_worldPubSubType::hello_worldPubSubType() -{ - setName("hello_world"); - auto type_size = hello_world::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = hello_world::isKeyDefined(); - size_t keyLength = hello_world::getKeyMaxCdrSerializedSize() > 16 ? - hello_world::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -hello_worldPubSubType::~hello_worldPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool hello_worldPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - hello_world* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool hello_worldPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - hello_world* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function hello_worldPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* hello_worldPubSubType::createData() -{ - return reinterpret_cast(new hello_world()); -} - -void hello_worldPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool hello_worldPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - hello_world* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - hello_world::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || hello_world::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.h deleted file mode 100644 index d261d555..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldPubSubTypes.h +++ /dev/null @@ -1,101 +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 hello_worldPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_PUBSUBTYPES_H_ - -#include -#include - -#include "hello_world.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated hello_world is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type hello_world defined by the user in the IDL file. - * @ingroup HELLO_WORLD - */ -class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef hello_world type; - - eProsima_user_DllExport hello_worldPubSubType(); - - eProsima_user_DllExport virtual ~hello_worldPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.cxx deleted file mode 100644 index aac863c3..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.cxx +++ /dev/null @@ -1,248 +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 hello_worldTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "hello_world.h" -#include "hello_worldTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerhello_worldTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("hello_world", Gethello_worldIdentifier(true), - Gethello_worldObject(true)); - factory->add_type_object("hello_world", Gethello_worldIdentifier(false), - Gethello_worldObject(false)); - -} - -const TypeIdentifier* Gethello_worldIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("hello_world", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Gethello_worldObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("hello_world", complete); -} - -const TypeObject* Gethello_worldObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("hello_world", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletehello_worldObject(); - } - //else - return GetMinimalhello_worldObject(); -} - -const TypeObject* GetMinimalhello_worldObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("hello_world", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_message; - mst_message.common().member_id(memberId++); - mst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_message.common().member_flags().IS_OPTIONAL(false); - mst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_message.common().member_flags().IS_KEY(false); - mst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - - MD5 message_hash("message"); - for(int i = 0; i < 4; ++i) - { - mst_message.detail().name_hash()[i] = message_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_message); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("hello_world", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("hello_world", false); -} - -const TypeObject* GetCompletehello_worldObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("hello_world", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_message; - cst_message.common().member_id(memberId++); - cst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_message.common().member_flags().IS_OPTIONAL(false); - cst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_message.common().member_flags().IS_KEY(false); - cst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - - cst_message.detail().name("message"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_message); - - - // Header - type_object->complete().struct_type().header().detail().type_name("hello_world"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("hello_world", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("hello_world", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.h deleted file mode 100644 index 7774c87b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/hello_worldTypeObject.h +++ /dev/null @@ -1,65 +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 hello_worldTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(hello_world_SOURCE) -#define hello_world_DllAPI __declspec( dllexport ) -#else -#define hello_world_DllAPI __declspec( dllimport ) -#endif // hello_world_SOURCE -#else -#define hello_world_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define hello_world_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerhello_worldTypes(); - -eProsima_user_DllExport const TypeIdentifier* Gethello_worldIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Gethello_worldObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalhello_worldObject(); -eProsima_user_DllExport const TypeObject* GetCompletehello_worldObject(); - - -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.cxx deleted file mode 100644 index b48a5d98..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.cxx +++ /dev/null @@ -1,194 +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 map_struct.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "map_struct.h" -#include "map_structTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -#define map_struct_max_cdr_typesize 26401ULL; -#define map_struct_max_key_cdr_typesize 0ULL; - -map_struct::map_struct() -{ - // map m_my_map - - - // Just to register all known types - registermap_structTypes(); -} - -map_struct::~map_struct() -{ -} - -map_struct::map_struct( - const map_struct& x) -{ - m_my_map = x.m_my_map; -} - -map_struct::map_struct( - map_struct&& x) noexcept -{ - m_my_map = std::move(x.m_my_map); -} - -map_struct& map_struct::operator =( - const map_struct& x) -{ - - m_my_map = x.m_my_map; - - return *this; -} - -map_struct& map_struct::operator =( - map_struct&& x) noexcept -{ - - m_my_map = std::move(x.m_my_map); - - return *this; -} - -bool map_struct::operator ==( - const map_struct& x) const -{ - - return (m_my_map == x.m_my_map); -} - -bool map_struct::operator !=( - const map_struct& x) const -{ - return !(*this == x); -} - -size_t map_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return map_struct_max_cdr_typesize; -} - -size_t map_struct::getCdrSerializedSize( - const map_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - for(auto a : data.my_map()) - { - (void)a; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + a.first.size() + 1; - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - } - - return current_alignment - initial_alignment; -} - -void map_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_my_map; -} - -void map_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_my_map;} - -/*! - * @brief This function copies the value in member my_map - * @param _my_map New value to be copied in member my_map - */ -void map_struct::my_map( - const std::map& _my_map) -{ - m_my_map = _my_map; -} - -/*! - * @brief This function moves the value in member my_map - * @param _my_map New value to be moved in member my_map - */ -void map_struct::my_map( - std::map&& _my_map) -{ - m_my_map = std::move(_my_map); -} - -/*! - * @brief This function returns a constant reference to member my_map - * @return Constant reference to member my_map - */ -const std::map& map_struct::my_map() const -{ - return m_my_map; -} - -/*! - * @brief This function returns a reference to member my_map - * @return Reference to member my_map - */ -std::map& map_struct::my_map() -{ - return m_my_map; -} - - -size_t map_struct::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return map_struct_max_key_cdr_typesize; -} - -bool map_struct::isKeyDefined() -{ - return false; -} - -void map_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.h deleted file mode 100644 index 232aea44..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_struct.h +++ /dev/null @@ -1,215 +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 map_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_H_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MAP_STRUCT_SOURCE) -#define MAP_STRUCT_DllAPI __declspec( dllexport ) -#else -#define MAP_STRUCT_DllAPI __declspec( dllimport ) -#endif // MAP_STRUCT_SOURCE -#else -#define MAP_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MAP_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure map_struct defined by the user in the IDL file. - * @ingroup map_struct - */ -class map_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport map_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~map_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct( - const map_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct( - map_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct& operator =( - const map_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct& operator =( - map_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x map_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const map_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x map_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const map_struct& x) const; - - /*! - * @brief This function copies the value in member my_map - * @param _my_map New value to be copied in member my_map - */ - eProsima_user_DllExport void my_map( - const std::map& _my_map); - - /*! - * @brief This function moves the value in member my_map - * @param _my_map New value to be moved in member my_map - */ - eProsima_user_DllExport void my_map( - std::map&& _my_map); - - /*! - * @brief This function returns a constant reference to member my_map - * @return Constant reference to member my_map - */ - eProsima_user_DllExport const std::map& my_map() const; - - /*! - * @brief This function returns a reference to member my_map - * @return Reference to member my_map - */ - eProsima_user_DllExport std::map& my_map(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const map_struct& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::map m_my_map; - -}; - -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.cxx deleted file mode 100644 index c6e6e006..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.cxx +++ /dev/null @@ -1,169 +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 map_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "map_structPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -map_structPubSubType::map_structPubSubType() -{ - setName("map_struct"); - auto type_size = map_struct::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = map_struct::isKeyDefined(); - size_t keyLength = map_struct::getKeyMaxCdrSerializedSize() > 16 ? - map_struct::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -map_structPubSubType::~map_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool map_structPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - map_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool map_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - map_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; -} - -std::function map_structPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* map_structPubSubType::createData() -{ - return reinterpret_cast(new map_struct()); -} - -void map_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool map_structPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - map_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - map_struct::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || map_struct::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.h deleted file mode 100644 index 80aa0787..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structPubSubTypes.h +++ /dev/null @@ -1,104 +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 map_structPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_PUBSUBTYPES_H_ - -#include -#include - -#include "map_struct.h" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated map_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type map_struct defined by the user in the IDL file. - * @ingroup map_struct - */ -class map_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef map_struct type; - - eProsima_user_DllExport map_structPubSubType(); - - eProsima_user_DllExport virtual ~map_structPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.cxx deleted file mode 100644 index 397ce137..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.cxx +++ /dev/null @@ -1,220 +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 map_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "map_struct.h" -#include "map_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registermap_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("map_struct", Getmap_structIdentifier(true), - Getmap_structObject(true)); - factory->add_type_object("map_struct", Getmap_structIdentifier(false), - Getmap_structObject(false)); - - }); -} - -const TypeIdentifier* Getmap_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("map_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getmap_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("map_struct", complete); -} - -const TypeObject* Getmap_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("map_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletemap_structObject(); - } - //else - return GetMinimalmap_structObject(); -} - -const TypeObject* GetMinimalmap_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("map_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_my_map; - mst_my_map.common().member_id(memberId++); - mst_my_map.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_my_map.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_my_map.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_my_map.common().member_flags().IS_OPTIONAL(false); - mst_my_map.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_my_map.common().member_flags().IS_KEY(false); - mst_my_map.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_my_map.common().member_type_id(*TypeObjectFactory::get_instance()->get_map_identifier(TypeNamesGenerator::get_string_type_name(255, false), "bool", 100, false)); - - - MD5 my_map_hash("my_map"); - for(int i = 0; i < 4; ++i) - { - mst_my_map.detail().name_hash()[i] = my_map_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_my_map); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("map_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("map_struct", false); -} - -const TypeObject* GetCompletemap_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("map_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_my_map; - cst_my_map.common().member_id(memberId++); - cst_my_map.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_my_map.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_my_map.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_my_map.common().member_flags().IS_OPTIONAL(false); - cst_my_map.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_my_map.common().member_flags().IS_KEY(false); - cst_my_map.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_my_map.common().member_type_id(*TypeObjectFactory::get_instance()->get_map_identifier(TypeNamesGenerator::get_string_type_name(255, false), "bool", 100, true)); - - - cst_my_map.detail().name("my_map"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_my_map); - - - // Header - type_object->complete().struct_type().header().detail().type_name("map_struct"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("map_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("map_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.h deleted file mode 100644 index 07559e37..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/map_structTypeObject.h +++ /dev/null @@ -1,63 +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 map_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(map_struct_SOURCE) -#define map_struct_DllAPI __declspec( dllexport ) -#else -#define map_struct_DllAPI __declspec( dllimport ) -#endif // map_struct_SOURCE -#else -#define map_struct_DllAPI -#endif -#else -#define map_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registermap_structTypes(); - -eProsima_user_DllExport const TypeIdentifier* Getmap_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getmap_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalmap_structObject(); -eProsima_user_DllExport const TypeObject* GetCompletemap_structObject(); - - -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.cxx deleted file mode 100644 index 6ec457f2..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.cxx +++ /dev/null @@ -1,197 +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 numeric_array.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "numeric_array.h" -#include "numeric_arrayTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -numeric_array::numeric_array() -{ - // m_points com.eprosima.idl.parser.typecode.ArrayTypeCode@cd2dae5 - memset(&m_points, 0, (3) * 4); - - // Just to register all known types - registernumeric_arrayTypes(); -} - -numeric_array::~numeric_array() -{ -} - -numeric_array::numeric_array( - const numeric_array& x) -{ - m_points = x.m_points; -} - -numeric_array::numeric_array( - numeric_array&& x) noexcept -{ - m_points = std::move(x.m_points); -} - -numeric_array& numeric_array::operator =( - const numeric_array& x) -{ - - m_points = x.m_points; - - return *this; -} - -numeric_array& numeric_array::operator =( - numeric_array&& x) noexcept -{ - - m_points = std::move(x.m_points); - - return *this; -} - -bool numeric_array::operator ==( - const numeric_array& x) const -{ - - return (m_points == x.m_points); -} - -bool numeric_array::operator !=( - const numeric_array& x) const -{ - return !(*this == x); -} - -size_t numeric_array::getMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t initial_alignment = current_alignment; - - - current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - -size_t numeric_array::getCdrSerializedSize( - const numeric_array& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - if ((3) > 0) - { - current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - } - - return current_alignment - initial_alignment; -} - -void numeric_array::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_points; - - -} - -void numeric_array::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_points; - -} - -/*! - * @brief This function copies the value in member points - * @param _points New value to be copied in member points - */ -void numeric_array::points( - const std::array& _points) -{ - m_points = _points; -} - -/*! - * @brief This function moves the value in member points - * @param _points New value to be moved in member points - */ -void numeric_array::points( - std::array&& _points) -{ - m_points = std::move(_points); -} - -/*! - * @brief This function returns a constant reference to member points - * @return Constant reference to member points - */ -const std::array& numeric_array::points() const -{ - return m_points; -} - -/*! - * @brief This function returns a reference to member points - * @return Reference to member points - */ -std::array& numeric_array::points() -{ - return m_points; -} - -size_t numeric_array::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - size_t current_align = current_alignment; - - - - return current_align; -} - -bool numeric_array::isKeyDefined() -{ - return false; -} - -void numeric_array::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.h deleted file mode 100644 index 5d23be32..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_array.h +++ /dev/null @@ -1,214 +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 numeric_array.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(numeric_array_SOURCE) -#define numeric_array_DllAPI __declspec( dllexport ) -#else -#define numeric_array_DllAPI __declspec( dllimport ) -#endif // numeric_array_SOURCE -#else -#define numeric_array_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define numeric_array_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure numeric_array defined by the user in the IDL file. - * @ingroup NUMERIC_ARRAY - */ -class numeric_array -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport numeric_array(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~numeric_array(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array( - const numeric_array& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array( - numeric_array&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array& operator =( - const numeric_array& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array& operator =( - numeric_array&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x numeric_array object to compare. - */ - eProsima_user_DllExport bool operator ==( - const numeric_array& x) const; - - /*! - * @brief Comparison operator. - * @param x numeric_array object to compare. - */ - eProsima_user_DllExport bool operator !=( - const numeric_array& x) const; - - /*! - * @brief This function copies the value in member points - * @param _points New value to be copied in member points - */ - eProsima_user_DllExport void points( - const std::array& _points); - - /*! - * @brief This function moves the value in member points - * @param _points New value to be moved in member points - */ - eProsima_user_DllExport void points( - std::array&& _points); - - /*! - * @brief This function returns a constant reference to member points - * @return Constant reference to member points - */ - eProsima_user_DllExport const std::array& points() const; - - /*! - * @brief This function returns a reference to member points - * @return Reference to member points - */ - eProsima_user_DllExport std::array& points(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const numeric_array& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - std::array m_points; -}; - -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.cxx deleted file mode 100644 index 1f6aa132..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.cxx +++ /dev/null @@ -1,169 +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 numeric_arrayPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "numeric_arrayPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -numeric_arrayPubSubType::numeric_arrayPubSubType() -{ - setName("numeric_array"); - auto type_size = numeric_array::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = numeric_array::isKeyDefined(); - size_t keyLength = numeric_array::getKeyMaxCdrSerializedSize() > 16 ? - numeric_array::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -numeric_arrayPubSubType::~numeric_arrayPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool numeric_arrayPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - numeric_array* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - // Serialize encapsulation - ser.serialize_encapsulation(); - - try - { - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool numeric_arrayPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - //Convert DATA to pointer of your type - numeric_array* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) - { - return false; - } - - return true; -} - -std::function numeric_arrayPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* numeric_arrayPubSubType::createData() -{ - return reinterpret_cast(new numeric_array()); -} - -void numeric_arrayPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool numeric_arrayPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - numeric_array* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - numeric_array::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || numeric_array::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.h deleted file mode 100644 index b975cd5e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayPubSubTypes.h +++ /dev/null @@ -1,101 +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 numeric_arrayPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_PUBSUBTYPES_H_ - -#include -#include - -#include "numeric_array.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated numeric_array is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -/*! - * @brief This class represents the TopicDataType of the type numeric_array defined by the user in the IDL file. - * @ingroup NUMERIC_ARRAY - */ -class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef numeric_array type; - - eProsima_user_DllExport numeric_arrayPubSubType(); - - eProsima_user_DllExport virtual ~numeric_arrayPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) numeric_array(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; -}; - -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.cxx deleted file mode 100644 index aaab64ae..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.cxx +++ /dev/null @@ -1,215 +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 numeric_arrayTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "numeric_array.h" -#include "numeric_arrayTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registernumeric_arrayTypes() -{ - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("numeric_array", Getnumeric_arrayIdentifier(true), - Getnumeric_arrayObject(true)); - factory->add_type_object("numeric_array", Getnumeric_arrayIdentifier(false), - Getnumeric_arrayObject(false)); - -} - -const TypeIdentifier* Getnumeric_arrayIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("numeric_array", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getnumeric_arrayObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("numeric_array", complete); -} - -const TypeObject* Getnumeric_arrayObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("numeric_array", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletenumeric_arrayObject(); - } - //else - return GetMinimalnumeric_arrayObject(); -} - -const TypeObject* GetMinimalnumeric_arrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("numeric_array", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_points; - mst_points.common().member_id(memberId++); - mst_points.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_points.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_points.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_points.common().member_flags().IS_OPTIONAL(false); - mst_points.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_points.common().member_flags().IS_KEY(false); - mst_points.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_points.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("int32_t", {3}, false)); - - - MD5 points_hash("points"); - for(int i = 0; i < 4; ++i) - { - mst_points.detail().name_hash()[i] = points_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_points); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("numeric_array", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("numeric_array", false); -} - -const TypeObject* GetCompletenumeric_arrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("numeric_array", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_points; - cst_points.common().member_id(memberId++); - cst_points.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_points.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_points.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_points.common().member_flags().IS_OPTIONAL(false); - cst_points.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_points.common().member_flags().IS_KEY(false); - cst_points.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_points.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("int32_t", {3}, true)); - - - cst_points.detail().name("points"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_points); - - - // Header - type_object->complete().struct_type().header().detail().type_name("numeric_array"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("numeric_array", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("numeric_array", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.h deleted file mode 100644 index 30c2eef2..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/numeric_arrayTypeObject.h +++ /dev/null @@ -1,65 +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 numeric_arrayTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define eProsima_user_DllExport -#endif // if defined(_WIN32) - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(numeric_array_SOURCE) -#define numeric_array_DllAPI __declspec( dllexport ) -#else -#define numeric_array_DllAPI __declspec( dllimport ) -#endif // numeric_array_SOURCE -#else -#define numeric_array_DllAPI -#endif // if defined(EPROSIMA_USER_DLL_EXPORT) -#else -#define numeric_array_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registernumeric_arrayTypes(); - -eProsima_user_DllExport const TypeIdentifier* Getnumeric_arrayIdentifier( - bool complete = false); -eProsima_user_DllExport const TypeObject* Getnumeric_arrayObject( - bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalnumeric_arrayObject(); -eProsima_user_DllExport const TypeObject* GetCompletenumeric_arrayObject(); - - -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.cxx deleted file mode 100644 index 8531c9f8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.cxx +++ /dev/null @@ -1,642 +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 union_struct.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "union_struct.h" -#include "union_structTypeObject.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -#define union_struct_max_cdr_typesize 268ULL; - -#define union_struct_max_key_cdr_typesize 0ULL; - - -MyUnion::MyUnion() -{ - m__d = 1; - // octet m_octet_value - m_octet_value = 0; - // long m_long_value - m_long_value = 0; - // string m_string_value - m_string_value =""; -} - -MyUnion::~MyUnion() -{ -} - -MyUnion::MyUnion( - const MyUnion& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - case 2: - m_long_value = x.m_long_value; - break; - case 3: - m_string_value = x.m_string_value; - break; - default: - break; - } -} - -MyUnion::MyUnion( - MyUnion&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - case 2: - m_long_value = x.m_long_value; - break; - case 3: - m_string_value = std::move(x.m_string_value); - break; - default: - break; - } -} - -MyUnion& MyUnion::operator =( - const MyUnion& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - case 2: - m_long_value = x.m_long_value; - break; - case 3: - m_string_value = x.m_string_value; - break; - default: - break; - } - - return *this; -} - -MyUnion& MyUnion::operator =( - MyUnion&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - case 2: - m_long_value = x.m_long_value; - break; - case 3: - m_string_value = std::move(x.m_string_value); - break; - default: - break; - } - - return *this; -} - -bool MyUnion::operator ==( - const MyUnion& x) const -{ - if (m__d != x.m__d) - { - return false; - } - - switch(m__d) - { - case 1: - return (m_octet_value == x.m_octet_value); - break; - case 2: - return (m_long_value == x.m_long_value); - break; - case 3: - return (m_string_value == x.m_string_value); - break; - default: - break; - } - return false; -} - -bool MyUnion::operator !=( - const MyUnion& x) const -{ - return !(*this == x); -} - -void MyUnion::_d( - int32_t __d) -{ - bool b = false; - - switch(m__d) - { - case 1: - switch(__d) - { - case 1: - b = true; - break; - default: - break; - } - break; - case 2: - switch(__d) - { - case 2: - b = true; - break; - default: - break; - } - break; - case 3: - switch(__d) - { - case 3: - b = true; - break; - default: - break; - } - break; - } - - if(!b) - { - throw BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; -} - -int32_t MyUnion::_d() const -{ - return m__d; -} - -int32_t& MyUnion::_d() -{ - return m__d; -} - -void MyUnion::octet_value( - uint8_t _octet_value) -{ - m_octet_value = _octet_value; - m__d = 1; -} - -uint8_t MyUnion::octet_value() const -{ - bool b = false; - - switch(m__d) - { - case 1: - b = true; - break; - default: - break; - } - if(!b) - { - throw BadParamException("This member is not been selected"); - } - - return m_octet_value; -} - -uint8_t& MyUnion::octet_value() -{ - bool b = false; - - switch(m__d) - { - case 1: - b = true; - break; - default: - break; - } - if(!b) - { - throw BadParamException("This member is not been selected"); - } - - return m_octet_value; -} -void MyUnion::long_value( - int32_t _long_value) -{ - m_long_value = _long_value; - m__d = 2; -} - -int32_t MyUnion::long_value() const -{ - bool b = false; - - switch(m__d) - { - case 2: - b = true; - break; - default: - break; - } - if(!b) - { - throw BadParamException("This member is not been selected"); - } - - return m_long_value; -} - -int32_t& MyUnion::long_value() -{ - bool b = false; - - switch(m__d) - { - case 2: - b = true; - break; - default: - break; - } - if(!b) - { - throw BadParamException("This member is not been selected"); - } - - return m_long_value; -} -void MyUnion::string_value( - const std::string& _string_value) -{ - m_string_value = _string_value; - m__d = 3; -} - -void MyUnion::string_value( - std::string&& _string_value) -{ - m_string_value = std::move(_string_value); - m__d = 3; -} - -const std::string& MyUnion::string_value() const -{ - bool b = false; - - switch(m__d) - { - case 3: - b = true; - break; - default: - break; - } - if(!b) - { - throw BadParamException("This member is not been selected"); - } - - return m_string_value; -} - -std::string& MyUnion::string_value() -{ - bool b = false; - - switch(m__d) - { - case 3: - b = true; - break; - default: - break; - } - if(!b) - { - throw BadParamException("This member is not been selected"); - } - - return m_string_value; -} - -// TODO(Ricardo) Review -size_t MyUnion::getCdrSerializedSize( - const MyUnion& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - switch(data.m__d) - { - case 1: - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - break; - case 2: - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - break; - case 3: - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.string_value().size() + 1; - break; - default: - break; - } - - return current_alignment - initial_alignment; -} - -void MyUnion::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m__d; - - switch(m__d) - { - case 1: - scdr << m_octet_value; - - break; - case 2: - scdr << m_long_value; - - break; - case 3: - scdr << m_string_value.c_str(); - - break; - default: - break; - } -} - -void MyUnion::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m__d; - - switch(m__d) - { - case 1: - dcdr >> m_octet_value; - break; - case 2: - dcdr >> m_long_value; - break; - case 3: - dcdr >> m_string_value;break; - default: - break; - } -} - - -union_struct::union_struct() -{ - // unsigned long m_index - m_index = 0; - // MyUnion m_union_value - - - // Just to register all known types - registerunion_structTypes(); -} - -union_struct::~union_struct() -{ - - -} - -union_struct::union_struct( - const union_struct& x) -{ - m_index = x.m_index; - m_union_value = x.m_union_value; -} - -union_struct::union_struct( - union_struct&& x) noexcept -{ - m_index = x.m_index; - m_union_value = std::move(x.m_union_value); -} - -union_struct& union_struct::operator =( - const union_struct& x) -{ - - m_index = x.m_index; - m_union_value = x.m_union_value; - - return *this; -} - -union_struct& union_struct::operator =( - union_struct&& x) noexcept -{ - - m_index = x.m_index; - m_union_value = std::move(x.m_union_value); - - return *this; -} - -bool union_struct::operator ==( - const union_struct& x) const -{ - - return (m_index == x.m_index && m_union_value == x.m_union_value); -} - -bool union_struct::operator !=( - const union_struct& x) const -{ - return !(*this == x); -} - -size_t union_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return union_struct_max_cdr_typesize; -} - -size_t union_struct::getCdrSerializedSize( - const union_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += MyUnion::getCdrSerializedSize(data.union_value(), current_alignment); - - return current_alignment - initial_alignment; -} - -void union_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_index; - scdr << m_union_value; - -} - -void union_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_index; - dcdr >> m_union_value; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void union_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t union_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& union_struct::index() -{ - return m_index; -} - -/*! - * @brief This function copies the value in member union_value - * @param _union_value New value to be copied in member union_value - */ -void union_struct::union_value( - const MyUnion& _union_value) -{ - m_union_value = _union_value; -} - -/*! - * @brief This function moves the value in member union_value - * @param _union_value New value to be moved in member union_value - */ -void union_struct::union_value( - MyUnion&& _union_value) -{ - m_union_value = std::move(_union_value); -} - -/*! - * @brief This function returns a constant reference to member union_value - * @return Constant reference to member union_value - */ -const MyUnion& union_struct::union_value() const -{ - return m_union_value; -} - -/*! - * @brief This function returns a reference to member union_value - * @return Reference to member union_value - */ -MyUnion& union_struct::union_value() -{ - return m_union_value; -} - - -size_t union_struct::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return union_struct_max_key_cdr_typesize; -} - -bool union_struct::isKeyDefined() -{ - return false; -} - -void union_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.h deleted file mode 100644 index 26739ce2..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_struct.h +++ /dev/null @@ -1,421 +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 union_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_H_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(UNION_STRUCT_SOURCE) -#define UNION_STRUCT_DllAPI __declspec( dllexport ) -#else -#define UNION_STRUCT_DllAPI __declspec( dllimport ) -#endif // UNION_STRUCT_SOURCE -#else -#define UNION_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define UNION_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the union MyUnion defined by the user in the IDL file. - * @ingroup union_struct - */ -class MyUnion -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MyUnion(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MyUnion(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - const MyUnion& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - MyUnion&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - const MyUnion& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - MyUnion&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MyUnion& x) const; - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MyUnion& x) const; - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - int32_t __d); - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport int32_t _d() const; - - /*! - * @brief This function returns a reference to the discriminator. - * @return Reference to the discriminator. - */ - eProsima_user_DllExport int32_t& _d(); - - /*! - * @brief This function sets a value in member octet_value - * @param _octet_value New value for member octet_value - */ - eProsima_user_DllExport void octet_value( - uint8_t _octet_value); - - /*! - * @brief This function returns the value of member octet_value - * @return Value of member octet_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t octet_value() const; - - /*! - * @brief This function returns a reference to member octet_value - * @return Reference to member octet_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t& octet_value(); - - /*! - * @brief This function sets a value in member long_value - * @param _long_value New value for member long_value - */ - eProsima_user_DllExport void long_value( - int32_t _long_value); - - /*! - * @brief This function returns the value of member long_value - * @return Value of member long_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t long_value() const; - - /*! - * @brief This function returns a reference to member long_value - * @return Reference to member long_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t& long_value(); - - /*! - * @brief This function copies the value in member string_value - * @param _string_value New value to be copied in member string_value - */ - eProsima_user_DllExport void string_value( - const std::string& _string_value); - - /*! - * @brief This function moves the value in member string_value - * @param _string_value New value to be moved in member string_value - */ - eProsima_user_DllExport void string_value( - std::string&& _string_value); - - /*! - * @brief This function returns a constant reference to member string_value - * @return Constant reference to member string_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::string& string_value() const; - - /*! - * @brief This function returns a reference to member string_value - * @return Reference to member string_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::string& string_value(); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MyUnion& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - -private: - - int32_t m__d; - - uint8_t m_octet_value; - int32_t m_long_value; - std::string m_string_value; -}; -/*! - * @brief This class represents the structure union_struct defined by the user in the IDL file. - * @ingroup union_struct - */ -class union_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport union_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~union_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - const union_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - union_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - const union_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - union_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const union_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const union_struct& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - /*! - * @brief This function copies the value in member union_value - * @param _union_value New value to be copied in member union_value - */ - eProsima_user_DllExport void union_value( - const MyUnion& _union_value); - - /*! - * @brief This function moves the value in member union_value - * @param _union_value New value to be moved in member union_value - */ - eProsima_user_DllExport void union_value( - MyUnion&& _union_value); - - /*! - * @brief This function returns a constant reference to member union_value - * @return Constant reference to member union_value - */ - eProsima_user_DllExport const MyUnion& union_value() const; - - /*! - * @brief This function returns a reference to member union_value - * @return Reference to member union_value - */ - eProsima_user_DllExport MyUnion& union_value(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const union_struct& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - uint32_t m_index; - MyUnion m_union_value; - -}; - -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.cxx deleted file mode 100644 index c1812023..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.cxx +++ /dev/null @@ -1,170 +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 union_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "union_structPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - - -union_structPubSubType::union_structPubSubType() -{ - setName("union_struct"); - auto type_size = union_struct::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = union_struct::isKeyDefined(); - size_t keyLength = union_struct::getKeyMaxCdrSerializedSize() > 16 ? - union_struct::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -union_structPubSubType::~union_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool union_structPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - union_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool union_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - union_struct* 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, eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; -} - -std::function union_structPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* union_structPubSubType::createData() -{ - return reinterpret_cast(new union_struct()); -} - -void union_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool union_structPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - union_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - union_struct::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || union_struct::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.h deleted file mode 100644 index 4e92f498..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structPubSubTypes.h +++ /dev/null @@ -1,105 +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 union_structPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_PUBSUBTYPES_H_ - -#include -#include - -#include "union_struct.h" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated union_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - - -/*! - * @brief This class represents the TopicDataType of the type union_struct defined by the user in the IDL file. - * @ingroup union_struct - */ -class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef union_struct type; - - eProsima_user_DllExport union_structPubSubType(); - - eProsima_user_DllExport virtual ~union_structPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - (void)memory; - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_PUBSUBTYPES_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.cxx deleted file mode 100644 index 8796c646..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.cxx +++ /dev/null @@ -1,512 +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 union_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "union_struct.h" -#include "union_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerunion_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("MyUnion", GetMyUnionIdentifier(true), - GetMyUnionObject(true)); - factory->add_type_object("MyUnion", GetMyUnionIdentifier(false), - GetMyUnionObject(false)); - - factory->add_type_object("union_struct", Getunion_structIdentifier(true), - Getunion_structObject(true)); - factory->add_type_object("union_struct", Getunion_structIdentifier(false), - Getunion_structObject(false)); - - }); -} - -const TypeIdentifier* GetMyUnionIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MyUnion", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMyUnionObject(complete); - return TypeObjectFactory::get_instance()->get_type_identifier("MyUnion", complete); -} - -const TypeObject* GetMyUnionObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MyUnion", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMyUnionObject(); - } - // else - return GetMinimalMyUnionObject(); -} - -const TypeObject* GetMinimalMyUnionObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MyUnion", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_UNION); - - type_object->minimal().union_type().union_flags().IS_FINAL(false); - type_object->minimal().union_type().union_flags().IS_APPENDABLE(false); - type_object->minimal().union_type().union_flags().IS_MUTABLE(false); - type_object->minimal().union_type().union_flags().IS_NESTED(false); - type_object->minimal().union_type().union_flags().IS_AUTOID_HASH(false); // Unsupported - - type_object->minimal().union_type().discriminator().common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - type_object->minimal().union_type().discriminator().common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - type_object->minimal().union_type().discriminator().common().member_flags().IS_EXTERNAL(false); // Doesn't apply - type_object->minimal().union_type().discriminator().common().member_flags().IS_OPTIONAL(false); // Doesn't apply - type_object->minimal().union_type().discriminator().common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - type_object->minimal().union_type().discriminator().common().member_flags().IS_KEY(false); // Unsupported - type_object->minimal().union_type().discriminator().common().member_flags().IS_DEFAULT(false); // Doesn't apply - - type_object->minimal().union_type().discriminator().common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - MemberId memberId = 0; - MinimalUnionMember mst_octet_value; - mst_octet_value.common().member_id(memberId++); - mst_octet_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_octet_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_octet_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_octet_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - mst_octet_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mst_octet_value.common().member_flags().IS_KEY(false); // Doesn't apply - mst_octet_value.common().member_flags().IS_DEFAULT(false); - mst_octet_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint8_t", false)); - - mst_octet_value.common().label_seq().emplace_back(1); - MD5 octet_value_hash("octet_value"); - for(int i = 0; i < 4; ++i) - { - mst_octet_value.detail().name_hash()[i] = octet_value_hash.digest[i]; - } - type_object->minimal().union_type().member_seq().emplace_back(mst_octet_value); - - MinimalUnionMember mst_long_value; - mst_long_value.common().member_id(memberId++); - mst_long_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_long_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_long_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_long_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - mst_long_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mst_long_value.common().member_flags().IS_KEY(false); // Doesn't apply - mst_long_value.common().member_flags().IS_DEFAULT(false); - mst_long_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - mst_long_value.common().label_seq().emplace_back(2); - MD5 long_value_hash("long_value"); - for(int i = 0; i < 4; ++i) - { - mst_long_value.detail().name_hash()[i] = long_value_hash.digest[i]; - } - type_object->minimal().union_type().member_seq().emplace_back(mst_long_value); - - MinimalUnionMember mst_string_value; - mst_string_value.common().member_id(memberId++); - mst_string_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_string_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_string_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_string_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - mst_string_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mst_string_value.common().member_flags().IS_KEY(false); // Doesn't apply - mst_string_value.common().member_flags().IS_DEFAULT(false); - mst_string_value.common().type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - - mst_string_value.common().label_seq().emplace_back(3); - MD5 string_value_hash("string_value"); - for(int i = 0; i < 4; ++i) - { - mst_string_value.detail().name_hash()[i] = string_value_hash.digest[i]; - } - type_object->minimal().union_type().member_seq().emplace_back(mst_string_value); - - - // Header - //type_object->minimal().union_type().header().detail()... // Empty - - TypeIdentifier* identifier = new TypeIdentifier(); - identifier->_d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalUnionType::getCdrSerializedSize(type_object->minimal().union_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier->equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MyUnion", identifier, type_object); - delete type_object; - delete identifier; - return TypeObjectFactory::get_instance()->get_type_object("MyUnion", false); -} - -const TypeObject* GetCompleteMyUnionObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MyUnion", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_UNION); - - type_object->complete().union_type().union_flags().IS_FINAL(false); - type_object->complete().union_type().union_flags().IS_APPENDABLE(false); - type_object->complete().union_type().union_flags().IS_MUTABLE(false); - type_object->complete().union_type().union_flags().IS_NESTED(false); - type_object->complete().union_type().union_flags().IS_AUTOID_HASH(false); // Unsupported - - type_object->complete().union_type().discriminator().common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - type_object->complete().union_type().discriminator().common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - type_object->complete().union_type().discriminator().common().member_flags().IS_EXTERNAL(false); // Doesn't apply - type_object->complete().union_type().discriminator().common().member_flags().IS_OPTIONAL(false); // Doesn't apply - type_object->complete().union_type().discriminator().common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - type_object->complete().union_type().discriminator().common().member_flags().IS_KEY(false); // Unsupported - type_object->complete().union_type().discriminator().common().member_flags().IS_DEFAULT(false); // Doesn't apply - - type_object->complete().union_type().discriminator().common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - MemberId memberId = 0; - CompleteUnionMember cst_octet_value; - cst_octet_value.common().member_id(memberId++); - cst_octet_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_octet_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_octet_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_octet_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - cst_octet_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cst_octet_value.common().member_flags().IS_KEY(false); // Doesn't apply - cst_octet_value.common().member_flags().IS_DEFAULT(false); - cst_octet_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint8_t", false)); - cst_octet_value.common().label_seq().emplace_back(1); - - cst_octet_value.detail().name("octet_value"); - - type_object->complete().union_type().member_seq().emplace_back(cst_octet_value); - - CompleteUnionMember cst_long_value; - cst_long_value.common().member_id(memberId++); - cst_long_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_long_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_long_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_long_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - cst_long_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cst_long_value.common().member_flags().IS_KEY(false); // Doesn't apply - cst_long_value.common().member_flags().IS_DEFAULT(false); - cst_long_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - cst_long_value.common().label_seq().emplace_back(2); - - cst_long_value.detail().name("long_value"); - - type_object->complete().union_type().member_seq().emplace_back(cst_long_value); - - CompleteUnionMember cst_string_value; - cst_string_value.common().member_id(memberId++); - cst_string_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_string_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_string_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_string_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - cst_string_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cst_string_value.common().member_flags().IS_KEY(false); // Doesn't apply - cst_string_value.common().member_flags().IS_DEFAULT(false); - cst_string_value.common().type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_string_value.common().label_seq().emplace_back(3); - - cst_string_value.detail().name("string_value"); - - type_object->complete().union_type().member_seq().emplace_back(cst_string_value); - - - // Header - type_object->complete().union_type().header().detail().type_name("MyUnion"); - - - TypeIdentifier* identifier = new TypeIdentifier(); - identifier->_d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteUnionType::getCdrSerializedSize(type_object->complete().union_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier->equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MyUnion", identifier, type_object); - delete type_object; - delete identifier; - return TypeObjectFactory::get_instance()->get_type_object("MyUnion", true); -} - -const TypeIdentifier* Getunion_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("union_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getunion_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("union_struct", complete); -} - -const TypeObject* Getunion_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("union_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteunion_structObject(); - } - //else - return GetMinimalunion_structObject(); -} - -const TypeObject* GetMinimalunion_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("union_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_union_value; - mst_union_value.common().member_id(memberId++); - mst_union_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_union_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_union_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_union_value.common().member_flags().IS_OPTIONAL(false); - mst_union_value.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_union_value.common().member_flags().IS_KEY(false); - mst_union_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_union_value.common().member_type_id(*GetMyUnionIdentifier(false)); - MD5 union_value_hash("union_value"); - for(int i = 0; i < 4; ++i) - { - mst_union_value.detail().name_hash()[i] = union_value_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_union_value); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - SerializedPayload_t payload(static_cast( - MinimalStructType::getCdrSerializedSize(type_object->minimal().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("union_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("union_struct", false); -} - -const TypeObject* GetCompleteunion_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("union_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_union_value; - cst_union_value.common().member_id(memberId++); - cst_union_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_union_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_union_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_union_value.common().member_flags().IS_OPTIONAL(false); - cst_union_value.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_union_value.common().member_flags().IS_KEY(false); - cst_union_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_union_value.common().member_type_id(*GetMyUnionIdentifier(true)); - cst_union_value.detail().name("union_value"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_union_value); - - - // Header - type_object->complete().struct_type().header().detail().type_name("union_struct"); - // TODO inheritance - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - SerializedPayload_t payload(static_cast( - CompleteStructType::getCdrSerializedSize(type_object->complete().struct_type()) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data. - payload.encapsulation = CDR_LE; - - type_object->serialize(ser); - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("union_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("union_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.h deleted file mode 100644 index f341bb35..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v1/type_objects/union_structTypeObject.h +++ /dev/null @@ -1,68 +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 union_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(union_struct_SOURCE) -#define union_struct_DllAPI __declspec( dllexport ) -#else -#define union_struct_DllAPI __declspec( dllimport ) -#endif // union_struct_SOURCE -#else -#define union_struct_DllAPI -#endif -#else -#define union_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerunion_structTypes(); - -eProsima_user_DllExport const TypeIdentifier* GetMyUnionIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMyUnionObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMyUnionObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMyUnionObject(); - -eProsima_user_DllExport const TypeIdentifier* Getunion_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getunion_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalunion_structObject(); -eProsima_user_DllExport const TypeObject* GetCompleteunion_structObject(); - - -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_H_ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/all_types.hpp deleted file mode 100644 index 65fa0566..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/all_types.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2022 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 all_types.hpp - */ - -/* - * USEFUL COMMAND - * - * for TYPE in hello_world numeric_array char_sequence basic_struct basic_array_struct float_bounded_sequence arrays_and_sequences complex_nested_arrays; do ${FASTDDSGEN_WS}/scripts/fastddsgen -replace -d ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/type_objects/ -typeobject -cs ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/idls/${TYPE}.idl; done - */ - -#pragma once - -#include -#include -#include - -#include -#include -#include - -#include "type_objects/hello_worldTypeObject.h" -#include "type_objects/numeric_arrayTypeObject.h" -#include "type_objects/char_sequenceTypeObject.h" -#include "type_objects/basic_structTypeObject.h" -#include "type_objects/basic_array_structTypeObject.h" -#include "type_objects/float_bounded_sequenceTypeObject.h" -#include "type_objects/arrays_and_sequencesTypeObject.h" -#include "type_objects/complex_nested_arraysTypeObject.h" -#include "type_objects/enum_structTypeObject.h" -#include "type_objects/union_structTypeObject.h" -#include "type_objects/map_structTypeObject.h" - -namespace test { - -ENUMERATION_BUILDER( - SupportedType, - hello_world, - numeric_array, - char_sequence, - basic_struct, - basic_array_struct, - float_bounded_sequence, - arrays_and_sequences, - complex_nested_arrays, - enum_struct, - union_struct, // NOTE: default case currently not supported in dynamic types - map_struct - ); - -eprosima::fastrtps::types::DynamicType_ptr get_dynamic_type( - SupportedType type) -{ - registerhello_worldTypes(); - registernumeric_arrayTypes(); - registerchar_sequenceTypes(); - registerbasic_structTypes(); - registerbasic_array_structTypes(); - registerfloat_bounded_sequenceTypes(); - registerarrays_and_sequencesTypes(); - registercomplex_nested_arraysTypes(); - registerenum_structTypes(); - registerunion_structTypes(); - registermap_structTypes(); - - auto type_name = to_string(type); - - auto type_obj_factory = eprosima::fastrtps::types::TypeObjectFactory::get_instance(); - auto type_id = type_obj_factory->get_type_identifier(type_name, true); - if (type_id == nullptr) - { - throw eprosima::utils::InconsistencyException("Not Type Id"); - } - - auto type_obj = type_obj_factory->get_type_object(type_id); - if (type_obj == nullptr) - { - throw eprosima::utils::InconsistencyException("Not Type Object"); - } - - return type_obj_factory->build_dynamic_type(type_name, type_id, type_obj); -} - -} /* namespace test */ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/arrays_and_sequences.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/arrays_and_sequences.idl deleted file mode 100644 index 5d9f9819..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/arrays_and_sequences.idl +++ /dev/null @@ -1,12 +0,0 @@ -struct AnInternalObject -{ - float x; - boolean positive; -}; - -struct arrays_and_sequences -{ - sequence unlimited_vector; - sequence limited_vector; - AnInternalObject limited_array[10]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_array_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_array_struct.idl deleted file mode 100644 index b81e5956..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_array_struct.idl +++ /dev/null @@ -1,11 +0,0 @@ -struct TheOtherObjectInArray -{ - long some_num; - boolean positive; -}; - -struct basic_array_struct -{ - unsigned long index; - TheOtherObjectInArray sub_structs[5]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_struct.idl deleted file mode 100644 index da2ea1bb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/basic_struct.idl +++ /dev/null @@ -1,9 +0,0 @@ -struct TheOtherObject -{ - long some_num; -}; - -struct basic_struct -{ - TheOtherObject sub_struct; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/char_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/char_sequence.idl deleted file mode 100644 index 0abf7dd8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/char_sequence.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct char_sequence -{ - sequence chars; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/complex_nested_arrays.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/complex_nested_arrays.idl deleted file mode 100644 index b4eca21b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/complex_nested_arrays.idl +++ /dev/null @@ -1,23 +0,0 @@ -struct ThirdLevelElement -{ - double x; - double y; -}; - -struct SecondLevelElement -{ - ThirdLevelElement an_element_alone; - sequence a_limited_other_value; -}; - -struct FirstLevelElement -{ - string useless_name; - sequence sub; - ThirdLevelElement an_element_alone; -}; - -struct complex_nested_arrays -{ - FirstLevelElement array_of_elements[3]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/enum_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/enum_struct.idl deleted file mode 100644 index c40eae6e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/enum_struct.idl +++ /dev/null @@ -1,12 +0,0 @@ -enum ColorEnum -{ - RED, - GREEN, - BLUE -}; - -struct enum_struct -{ - unsigned long index; - ColorEnum enum_value; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/float_bounded_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/float_bounded_sequence.idl deleted file mode 100644 index b297df86..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/float_bounded_sequence.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct float_bounded_sequence -{ - sequence numbers; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/hello_world.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/hello_world.idl deleted file mode 100644 index d82036d8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/hello_world.idl +++ /dev/null @@ -1,5 +0,0 @@ -struct hello_world -{ - unsigned long index; - string message; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/map_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/map_struct.idl deleted file mode 100644 index d4d19acb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/map_struct.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct map_struct -{ - map my_map; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/numeric_array.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/numeric_array.idl deleted file mode 100644 index 814abd59..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/numeric_array.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct numeric_array -{ - long points[3]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/union_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/union_struct.idl deleted file mode 100644 index 3967f961..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/idls/union_struct.idl +++ /dev/null @@ -1,15 +0,0 @@ -union MyUnion switch (long) -{ - case 1: - octet octet_value; - case 2: - long long_value; - case 3: - string string_value; -}; - -struct union_struct -{ - unsigned long index; - MyUnion union_value; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/arrays_and_sequences.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/arrays_and_sequences.msg deleted file mode 100644 index 1942bc58..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/arrays_and_sequences.msg +++ /dev/null @@ -1,7 +0,0 @@ -AnInternalObject[] unlimited_vector -AnInternalObject[<=10] limited_vector -AnInternalObject[10] limited_array -================================================================================ -MSG: fastdds/AnInternalObject -float32 x -bool positive diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_array_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_array_struct.msg deleted file mode 100644 index a012398a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_array_struct.msg +++ /dev/null @@ -1,6 +0,0 @@ -uint32 index -TheOtherObjectInArray[5] sub_structs -================================================================================ -MSG: fastdds/TheOtherObjectInArray -int32 some_num -bool positive diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_struct.msg deleted file mode 100644 index eb9814cb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/basic_struct.msg +++ /dev/null @@ -1,4 +0,0 @@ -TheOtherObject sub_struct -================================================================================ -MSG: fastdds/TheOtherObject -int32 some_num diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/char_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/char_sequence.msg deleted file mode 100644 index bf4b2456..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/char_sequence.msg +++ /dev/null @@ -1 +0,0 @@ -int8[] chars diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/complex_nested_arrays.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/complex_nested_arrays.msg deleted file mode 100644 index 5eebc2f4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/complex_nested_arrays.msg +++ /dev/null @@ -1,14 +0,0 @@ -FirstLevelElement[3] array_of_elements -================================================================================ -MSG: fastdds/ThirdLevelElement -float64 x -float64 y -================================================================================ -MSG: fastdds/SecondLevelElement -ThirdLevelElement an_element_alone -ThirdLevelElement[<=1] a_limited_other_value -================================================================================ -MSG: fastdds/FirstLevelElement -string useless_name -SecondLevelElement[] sub -ThirdLevelElement an_element_alone diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/float_bounded_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/float_bounded_sequence.msg deleted file mode 100644 index 77503c2e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/float_bounded_sequence.msg +++ /dev/null @@ -1 +0,0 @@ -float32[<=13] numbers diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/hello_world.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/hello_world.msg deleted file mode 100644 index 63e3fbcb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/hello_world.msg +++ /dev/null @@ -1,2 +0,0 @@ -uint32 index -string message diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/numeric_array.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/numeric_array.msg deleted file mode 100644 index d391c85d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/msgs/numeric_array.msg +++ /dev/null @@ -1 +0,0 @@ -int32[3] points diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequences.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequences.cxx deleted file mode 100644 index 096ae93e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequences.cxx +++ /dev/null @@ -1,341 +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 arrays_and_sequences.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "arrays_and_sequences.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "arrays_and_sequencesTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -AnInternalObject::AnInternalObject() -{ - // Just to register all known types - registerarrays_and_sequencesTypes(); -} - -AnInternalObject::~AnInternalObject() -{ -} - -AnInternalObject::AnInternalObject( - const AnInternalObject& x) -{ - m_x = x.m_x; - m_positive = x.m_positive; -} - -AnInternalObject::AnInternalObject( - AnInternalObject&& x) noexcept -{ - m_x = x.m_x; - m_positive = x.m_positive; -} - -AnInternalObject& AnInternalObject::operator =( - const AnInternalObject& x) -{ - - m_x = x.m_x; - m_positive = x.m_positive; - return *this; -} - -AnInternalObject& AnInternalObject::operator =( - AnInternalObject&& x) noexcept -{ - - m_x = x.m_x; - m_positive = x.m_positive; - return *this; -} - -bool AnInternalObject::operator ==( - const AnInternalObject& x) const -{ - return (m_x == x.m_x && - m_positive == x.m_positive); -} - -bool AnInternalObject::operator !=( - const AnInternalObject& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ -void AnInternalObject::x( - float _x) -{ - m_x = _x; -} - -/*! - * @brief This function returns the value of member x - * @return Value of member x - */ -float AnInternalObject::x() const -{ - return m_x; -} - -/*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ -float& AnInternalObject::x() -{ - return m_x; -} - - -/*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ -void AnInternalObject::positive( - bool _positive) -{ - m_positive = _positive; -} - -/*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ -bool AnInternalObject::positive() const -{ - return m_positive; -} - -/*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ -bool& AnInternalObject::positive() -{ - return m_positive; -} - - - - -arrays_and_sequences::arrays_and_sequences() -{ - // Just to register all known types - registerarrays_and_sequencesTypes(); -} - -arrays_and_sequences::~arrays_and_sequences() -{ -} - -arrays_and_sequences::arrays_and_sequences( - const arrays_and_sequences& x) -{ - m_unlimited_vector = x.m_unlimited_vector; - m_limited_vector = x.m_limited_vector; - m_limited_array = x.m_limited_array; -} - -arrays_and_sequences::arrays_and_sequences( - arrays_and_sequences&& x) noexcept -{ - m_unlimited_vector = std::move(x.m_unlimited_vector); - m_limited_vector = std::move(x.m_limited_vector); - m_limited_array = std::move(x.m_limited_array); -} - -arrays_and_sequences& arrays_and_sequences::operator =( - const arrays_and_sequences& x) -{ - - m_unlimited_vector = x.m_unlimited_vector; - m_limited_vector = x.m_limited_vector; - m_limited_array = x.m_limited_array; - return *this; -} - -arrays_and_sequences& arrays_and_sequences::operator =( - arrays_and_sequences&& x) noexcept -{ - - m_unlimited_vector = std::move(x.m_unlimited_vector); - m_limited_vector = std::move(x.m_limited_vector); - m_limited_array = std::move(x.m_limited_array); - return *this; -} - -bool arrays_and_sequences::operator ==( - const arrays_and_sequences& x) const -{ - return (m_unlimited_vector == x.m_unlimited_vector && - m_limited_vector == x.m_limited_vector && - m_limited_array == x.m_limited_array); -} - -bool arrays_and_sequences::operator !=( - const arrays_and_sequences& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member unlimited_vector - * @param _unlimited_vector New value to be copied in member unlimited_vector - */ -void arrays_and_sequences::unlimited_vector( - const std::vector& _unlimited_vector) -{ - m_unlimited_vector = _unlimited_vector; -} - -/*! - * @brief This function moves the value in member unlimited_vector - * @param _unlimited_vector New value to be moved in member unlimited_vector - */ -void arrays_and_sequences::unlimited_vector( - std::vector&& _unlimited_vector) -{ - m_unlimited_vector = std::move(_unlimited_vector); -} - -/*! - * @brief This function returns a constant reference to member unlimited_vector - * @return Constant reference to member unlimited_vector - */ -const std::vector& arrays_and_sequences::unlimited_vector() const -{ - return m_unlimited_vector; -} - -/*! - * @brief This function returns a reference to member unlimited_vector - * @return Reference to member unlimited_vector - */ -std::vector& arrays_and_sequences::unlimited_vector() -{ - return m_unlimited_vector; -} - - -/*! - * @brief This function copies the value in member limited_vector - * @param _limited_vector New value to be copied in member limited_vector - */ -void arrays_and_sequences::limited_vector( - const std::vector& _limited_vector) -{ - m_limited_vector = _limited_vector; -} - -/*! - * @brief This function moves the value in member limited_vector - * @param _limited_vector New value to be moved in member limited_vector - */ -void arrays_and_sequences::limited_vector( - std::vector&& _limited_vector) -{ - m_limited_vector = std::move(_limited_vector); -} - -/*! - * @brief This function returns a constant reference to member limited_vector - * @return Constant reference to member limited_vector - */ -const std::vector& arrays_and_sequences::limited_vector() const -{ - return m_limited_vector; -} - -/*! - * @brief This function returns a reference to member limited_vector - * @return Reference to member limited_vector - */ -std::vector& arrays_and_sequences::limited_vector() -{ - return m_limited_vector; -} - - -/*! - * @brief This function copies the value in member limited_array - * @param _limited_array New value to be copied in member limited_array - */ -void arrays_and_sequences::limited_array( - const std::array& _limited_array) -{ - m_limited_array = _limited_array; -} - -/*! - * @brief This function moves the value in member limited_array - * @param _limited_array New value to be moved in member limited_array - */ -void arrays_and_sequences::limited_array( - std::array&& _limited_array) -{ - m_limited_array = std::move(_limited_array); -} - -/*! - * @brief This function returns a constant reference to member limited_array - * @return Constant reference to member limited_array - */ -const std::array& arrays_and_sequences::limited_array() const -{ - return m_limited_array; -} - -/*! - * @brief This function returns a reference to member limited_array - * @return Reference to member limited_array - */ -std::array& arrays_and_sequences::limited_array() -{ - return m_limited_array; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "arrays_and_sequencesCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.cxx deleted file mode 100644 index 4022a550..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.cxx +++ /dev/null @@ -1,512 +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 arrays_and_sequencesTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "arrays_and_sequences.h" -#include "arrays_and_sequencesTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerarrays_and_sequencesTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("AnInternalObject", GetAnInternalObjectIdentifier(true), - GetAnInternalObjectObject(true)); - factory->add_type_object("AnInternalObject", GetAnInternalObjectIdentifier(false), - GetAnInternalObjectObject(false)); - - - factory->add_type_object("arrays_and_sequences", Getarrays_and_sequencesIdentifier(true), - Getarrays_and_sequencesObject(true)); - factory->add_type_object("arrays_and_sequences", Getarrays_and_sequencesIdentifier(false), - Getarrays_and_sequencesObject(false)); - - }); -} - - - -const TypeIdentifier* GetAnInternalObjectIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("AnInternalObject", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetAnInternalObjectObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("AnInternalObject", complete); -} - -const TypeObject* GetAnInternalObjectObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteAnInternalObjectObject(); - } - //else - return GetMinimalAnInternalObjectObject(); -} - -const TypeObject* GetMinimalAnInternalObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_x; - mst_x.common().member_id(memberId++); - mst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_x.common().member_flags().IS_OPTIONAL(false); - mst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_x.common().member_flags().IS_KEY(false); - mst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("float", false)); - - - MD5 x_hash("x"); - for(int i = 0; i < 4; ++i) - { - mst_x.detail().name_hash()[i] = x_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_x); - - MinimalStructMember mst_positive; - mst_positive.common().member_id(memberId++); - mst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_positive.common().member_flags().IS_OPTIONAL(false); - mst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_positive.common().member_flags().IS_KEY(false); - mst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 positive_hash("positive"); - for(int i = 0; i < 4; ++i) - { - mst_positive.detail().name_hash()[i] = positive_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_positive); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("AnInternalObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", false); -} - -const TypeObject* GetCompleteAnInternalObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_x; - cst_x.common().member_id(memberId++); - cst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_x.common().member_flags().IS_OPTIONAL(false); - cst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_x.common().member_flags().IS_KEY(false); - cst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("float", false)); - - - cst_x.detail().name("x"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_x); - - CompleteStructMember cst_positive; - cst_positive.common().member_id(memberId++); - cst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_positive.common().member_flags().IS_OPTIONAL(false); - cst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_positive.common().member_flags().IS_KEY(false); - cst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_positive.detail().name("positive"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_positive); - - - // Header - type_object->complete().struct_type().header().detail().type_name("AnInternalObject"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("AnInternalObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("AnInternalObject", true); -} - - - -const TypeIdentifier* Getarrays_and_sequencesIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("arrays_and_sequences", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getarrays_and_sequencesObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("arrays_and_sequences", complete); -} - -const TypeObject* Getarrays_and_sequencesObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletearrays_and_sequencesObject(); - } - //else - return GetMinimalarrays_and_sequencesObject(); -} - -const TypeObject* GetMinimalarrays_and_sequencesObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_unlimited_vector; - mst_unlimited_vector.common().member_id(memberId++); - mst_unlimited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_unlimited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_unlimited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_unlimited_vector.common().member_flags().IS_OPTIONAL(false); - mst_unlimited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_unlimited_vector.common().member_flags().IS_KEY(false); - mst_unlimited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_unlimited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 0, false)); - - MD5 unlimited_vector_hash("unlimited_vector"); - for(int i = 0; i < 4; ++i) - { - mst_unlimited_vector.detail().name_hash()[i] = unlimited_vector_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_unlimited_vector); - - MinimalStructMember mst_limited_vector; - mst_limited_vector.common().member_id(memberId++); - mst_limited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_limited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_limited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_limited_vector.common().member_flags().IS_OPTIONAL(false); - mst_limited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_limited_vector.common().member_flags().IS_KEY(false); - mst_limited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_limited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 10, false)); - - MD5 limited_vector_hash("limited_vector"); - for(int i = 0; i < 4; ++i) - { - mst_limited_vector.detail().name_hash()[i] = limited_vector_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_limited_vector); - - MinimalStructMember mst_limited_array; - mst_limited_array.common().member_id(memberId++); - mst_limited_array.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_limited_array.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_limited_array.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_limited_array.common().member_flags().IS_OPTIONAL(false); - mst_limited_array.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_limited_array.common().member_flags().IS_KEY(false); - mst_limited_array.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_limited_array.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("AnInternalObject", {10}, false)); - - MD5 limited_array_hash("limited_array"); - for(int i = 0; i < 4; ++i) - { - mst_limited_array.detail().name_hash()[i] = limited_array_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_limited_array); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("arrays_and_sequences", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", false); -} - -const TypeObject* GetCompletearrays_and_sequencesObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_unlimited_vector; - cst_unlimited_vector.common().member_id(memberId++); - cst_unlimited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_unlimited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_unlimited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_unlimited_vector.common().member_flags().IS_OPTIONAL(false); - cst_unlimited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_unlimited_vector.common().member_flags().IS_KEY(false); - cst_unlimited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_unlimited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 0, true)); - - cst_unlimited_vector.detail().name("unlimited_vector"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_unlimited_vector); - - CompleteStructMember cst_limited_vector; - cst_limited_vector.common().member_id(memberId++); - cst_limited_vector.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_limited_vector.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_limited_vector.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_limited_vector.common().member_flags().IS_OPTIONAL(false); - cst_limited_vector.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_limited_vector.common().member_flags().IS_KEY(false); - cst_limited_vector.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_limited_vector.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("AnInternalObject", 10, true)); - - cst_limited_vector.detail().name("limited_vector"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_limited_vector); - - CompleteStructMember cst_limited_array; - cst_limited_array.common().member_id(memberId++); - cst_limited_array.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_limited_array.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_limited_array.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_limited_array.common().member_flags().IS_OPTIONAL(false); - cst_limited_array.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_limited_array.common().member_flags().IS_KEY(false); - cst_limited_array.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_limited_array.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("AnInternalObject", {10}, true)); - - cst_limited_array.detail().name("limited_array"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_limited_array); - - - // Header - type_object->complete().struct_type().header().detail().type_name("arrays_and_sequences"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("arrays_and_sequences", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("arrays_and_sequences", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.h deleted file mode 100644 index e0e979ef..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesTypeObject.h +++ /dev/null @@ -1,72 +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 arrays_and_sequencesTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(arrays_and_sequences_SOURCE) -#define arrays_and_sequences_DllAPI __declspec( dllexport ) -#else -#define arrays_and_sequences_DllAPI __declspec( dllimport ) -#endif // arrays_and_sequences_SOURCE -#else -#define arrays_and_sequences_DllAPI -#endif -#else -#define arrays_and_sequences_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerarrays_and_sequencesTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetAnInternalObjectIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetAnInternalObjectObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalAnInternalObjectObject(); -eProsima_user_DllExport const TypeObject* GetCompleteAnInternalObjectObject(); - - - -eProsima_user_DllExport const TypeIdentifier* Getarrays_and_sequencesIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getarrays_and_sequencesObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalarrays_and_sequencesObject(); -eProsima_user_DllExport const TypeObject* GetCompletearrays_and_sequencesObject(); - - -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.cxx deleted file mode 100644 index 7171511b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.cxx +++ /dev/null @@ -1,575 +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 arrays_and_sequences.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "arrays_and_sequences.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "arrays_and_sequencesTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define arrays_and_sequences_max_cdr_typesize 261ULL; -#define AnInternalObject_max_cdr_typesize 9ULL; - - - - -AnInternalObject::AnInternalObject() -{ - // float m_x - m_x = 0.0; - // boolean m_positive - m_positive = false; - - // Just to register all known types - registerarrays_and_sequencesTypes(); -} - -AnInternalObject::~AnInternalObject() -{ -} - -AnInternalObject::AnInternalObject( - const AnInternalObject& x) -{ - m_x = x.m_x; - - - m_positive = x.m_positive; - -} - -AnInternalObject::AnInternalObject( - AnInternalObject&& x) noexcept -{ - m_x = x.m_x; - - - m_positive = x.m_positive; - -} - -AnInternalObject& AnInternalObject::operator =( - const AnInternalObject& x) -{ - m_x = x.m_x; - - - m_positive = x.m_positive; - - return *this; -} - -AnInternalObject& AnInternalObject::operator =( - AnInternalObject&& x) noexcept -{ - m_x = x.m_x; - - - m_positive = x.m_positive; - - return *this; -} - -bool AnInternalObject::operator ==( - const AnInternalObject& x) const -{ - return (m_x == x.m_x && - m_positive == x.m_positive); -} - -bool AnInternalObject::operator !=( - const AnInternalObject& x) const -{ - return !(*this == x); -} - -size_t AnInternalObject::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return AnInternalObject_max_cdr_typesize; -} - -size_t AnInternalObject::getCdrSerializedSize( - const AnInternalObject& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - return current_alignment - initial_alignment; -} - - -void AnInternalObject::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_x; - - scdr << m_positive; - -} - -void AnInternalObject::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_x; - - - - dcdr >> m_positive; - - -} - - -bool AnInternalObject::isKeyDefined() -{ - return false; -} - -void AnInternalObject::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ -void AnInternalObject::x( - float _x) -{ - m_x = _x; -} - -/*! - * @brief This function returns the value of member x - * @return Value of member x - */ -float AnInternalObject::x() const -{ - return m_x; -} - -/*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ -float& AnInternalObject::x() -{ - return m_x; -} - - -/*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ -void AnInternalObject::positive( - bool _positive) -{ - m_positive = _positive; -} - -/*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ -bool AnInternalObject::positive() const -{ - return m_positive; -} - -/*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ -bool& AnInternalObject::positive() -{ - return m_positive; -} - - - - - -arrays_and_sequences::arrays_and_sequences() -{ - // sequence m_unlimited_vector - - // sequence m_limited_vector - - // AnInternalObject m_limited_array - - - // Just to register all known types - registerarrays_and_sequencesTypes(); -} - -arrays_and_sequences::~arrays_and_sequences() -{ -} - -arrays_and_sequences::arrays_and_sequences( - const arrays_and_sequences& x) -{ - m_unlimited_vector = x.m_unlimited_vector; - - - m_limited_vector = x.m_limited_vector; - - - m_limited_array = x.m_limited_array; - -} - -arrays_and_sequences::arrays_and_sequences( - arrays_and_sequences&& x) noexcept -{ - m_unlimited_vector = std::move(x.m_unlimited_vector); - - - m_limited_vector = std::move(x.m_limited_vector); - - - m_limited_array = std::move(x.m_limited_array); - -} - -arrays_and_sequences& arrays_and_sequences::operator =( - const arrays_and_sequences& x) -{ - m_unlimited_vector = x.m_unlimited_vector; - - - m_limited_vector = x.m_limited_vector; - - - m_limited_array = x.m_limited_array; - - return *this; -} - -arrays_and_sequences& arrays_and_sequences::operator =( - arrays_and_sequences&& x) noexcept -{ - m_unlimited_vector = std::move(x.m_unlimited_vector); - - - m_limited_vector = std::move(x.m_limited_vector); - - - m_limited_array = std::move(x.m_limited_array); - - return *this; -} - -bool arrays_and_sequences::operator ==( - const arrays_and_sequences& x) const -{ - return (m_unlimited_vector == x.m_unlimited_vector && - m_limited_vector == x.m_limited_vector && - m_limited_array == x.m_limited_array); -} - -bool arrays_and_sequences::operator !=( - const arrays_and_sequences& x) const -{ - return !(*this == x); -} - -size_t arrays_and_sequences::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return arrays_and_sequences_max_cdr_typesize; -} - -size_t arrays_and_sequences::getCdrSerializedSize( - const arrays_and_sequences& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.unlimited_vector().size(); ++a) - { - current_alignment += AnInternalObject::getCdrSerializedSize(data.unlimited_vector().at(a), current_alignment); - } - - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.limited_vector().size(); ++a) - { - current_alignment += AnInternalObject::getCdrSerializedSize(data.limited_vector().at(a), current_alignment); - } - - - - - for(size_t a = 0; a < data.limited_array().size(); ++a) - { - current_alignment += AnInternalObject::getCdrSerializedSize(data.limited_array().at(a), current_alignment); - - } - - - - return current_alignment - initial_alignment; -} - - -void arrays_and_sequences::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_unlimited_vector; - - - scdr << m_limited_vector; - - - scdr << m_limited_array; - - -} - -void arrays_and_sequences::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_unlimited_vector; - - - - dcdr >> m_limited_vector; - - - - dcdr >> m_limited_array; - - -} - - -bool arrays_and_sequences::isKeyDefined() -{ - return false; -} - -void arrays_and_sequences::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member unlimited_vector - * @param _unlimited_vector New value to be copied in member unlimited_vector - */ -void arrays_and_sequences::unlimited_vector( - const std::vector& _unlimited_vector) -{ - m_unlimited_vector = _unlimited_vector; -} - -/*! - * @brief This function moves the value in member unlimited_vector - * @param _unlimited_vector New value to be moved in member unlimited_vector - */ -void arrays_and_sequences::unlimited_vector( - std::vector&& _unlimited_vector) -{ - m_unlimited_vector = std::move(_unlimited_vector); -} - -/*! - * @brief This function returns a constant reference to member unlimited_vector - * @return Constant reference to member unlimited_vector - */ -const std::vector& arrays_and_sequences::unlimited_vector() const -{ - return m_unlimited_vector; -} - -/*! - * @brief This function returns a reference to member unlimited_vector - * @return Reference to member unlimited_vector - */ -std::vector& arrays_and_sequences::unlimited_vector() -{ - return m_unlimited_vector; -} - - -/*! - * @brief This function copies the value in member limited_vector - * @param _limited_vector New value to be copied in member limited_vector - */ -void arrays_and_sequences::limited_vector( - const std::vector& _limited_vector) -{ - m_limited_vector = _limited_vector; -} - -/*! - * @brief This function moves the value in member limited_vector - * @param _limited_vector New value to be moved in member limited_vector - */ -void arrays_and_sequences::limited_vector( - std::vector&& _limited_vector) -{ - m_limited_vector = std::move(_limited_vector); -} - -/*! - * @brief This function returns a constant reference to member limited_vector - * @return Constant reference to member limited_vector - */ -const std::vector& arrays_and_sequences::limited_vector() const -{ - return m_limited_vector; -} - -/*! - * @brief This function returns a reference to member limited_vector - * @return Reference to member limited_vector - */ -std::vector& arrays_and_sequences::limited_vector() -{ - return m_limited_vector; -} - - -/*! - * @brief This function copies the value in member limited_array - * @param _limited_array New value to be copied in member limited_array - */ -void arrays_and_sequences::limited_array( - const std::array& _limited_array) -{ - m_limited_array = _limited_array; -} - -/*! - * @brief This function moves the value in member limited_array - * @param _limited_array New value to be moved in member limited_array - */ -void arrays_and_sequences::limited_array( - std::array&& _limited_array) -{ - m_limited_array = std::move(_limited_array); -} - -/*! - * @brief This function returns a constant reference to member limited_array - * @return Constant reference to member limited_array - */ -const std::array& arrays_and_sequences::limited_array() const -{ - return m_limited_array; -} - -/*! - * @brief This function returns a reference to member limited_array - * @return Reference to member limited_array - */ -std::array& arrays_and_sequences::limited_array() -{ - return m_limited_array; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.h deleted file mode 100644 index 69c73768..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/arrays_and_sequencesv1.h +++ /dev/null @@ -1,438 +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 arrays_and_sequences.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(ARRAYS_AND_SEQUENCES_SOURCE) -#define ARRAYS_AND_SEQUENCES_DllAPI __declspec( dllexport ) -#else -#define ARRAYS_AND_SEQUENCES_DllAPI __declspec( dllimport ) -#endif // ARRAYS_AND_SEQUENCES_SOURCE -#else -#define ARRAYS_AND_SEQUENCES_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define ARRAYS_AND_SEQUENCES_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure AnInternalObject defined by the user in the IDL file. - * @ingroup arrays_and_sequences - */ -class AnInternalObject -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport AnInternalObject(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~AnInternalObject(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject( - const AnInternalObject& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject( - AnInternalObject&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject& operator =( - const AnInternalObject& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject& operator =( - AnInternalObject&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x AnInternalObject object to compare. - */ - eProsima_user_DllExport bool operator ==( - const AnInternalObject& x) const; - - /*! - * @brief Comparison operator. - * @param x AnInternalObject object to compare. - */ - eProsima_user_DllExport bool operator !=( - const AnInternalObject& x) const; - - /*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ - eProsima_user_DllExport void x( - float _x); - - /*! - * @brief This function returns the value of member x - * @return Value of member x - */ - eProsima_user_DllExport float x() const; - - /*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ - eProsima_user_DllExport float& x(); - - - /*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ - eProsima_user_DllExport void positive( - bool _positive); - - /*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ - eProsima_user_DllExport bool positive() const; - - /*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ - eProsima_user_DllExport bool& positive(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const AnInternalObject& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - float m_x; - bool m_positive; - -}; - - - -/*! - * @brief This class represents the structure arrays_and_sequences defined by the user in the IDL file. - * @ingroup arrays_and_sequences - */ -class arrays_and_sequences -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport arrays_and_sequences(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~arrays_and_sequences(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences( - const arrays_and_sequences& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences( - arrays_and_sequences&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences& operator =( - const arrays_and_sequences& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences& operator =( - arrays_and_sequences&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x arrays_and_sequences object to compare. - */ - eProsima_user_DllExport bool operator ==( - const arrays_and_sequences& x) const; - - /*! - * @brief Comparison operator. - * @param x arrays_and_sequences object to compare. - */ - eProsima_user_DllExport bool operator !=( - const arrays_and_sequences& x) const; - - /*! - * @brief This function copies the value in member unlimited_vector - * @param _unlimited_vector New value to be copied in member unlimited_vector - */ - eProsima_user_DllExport void unlimited_vector( - const std::vector& _unlimited_vector); - - /*! - * @brief This function moves the value in member unlimited_vector - * @param _unlimited_vector New value to be moved in member unlimited_vector - */ - eProsima_user_DllExport void unlimited_vector( - std::vector&& _unlimited_vector); - - /*! - * @brief This function returns a constant reference to member unlimited_vector - * @return Constant reference to member unlimited_vector - */ - eProsima_user_DllExport const std::vector& unlimited_vector() const; - - /*! - * @brief This function returns a reference to member unlimited_vector - * @return Reference to member unlimited_vector - */ - eProsima_user_DllExport std::vector& unlimited_vector(); - - - /*! - * @brief This function copies the value in member limited_vector - * @param _limited_vector New value to be copied in member limited_vector - */ - eProsima_user_DllExport void limited_vector( - const std::vector& _limited_vector); - - /*! - * @brief This function moves the value in member limited_vector - * @param _limited_vector New value to be moved in member limited_vector - */ - eProsima_user_DllExport void limited_vector( - std::vector&& _limited_vector); - - /*! - * @brief This function returns a constant reference to member limited_vector - * @return Constant reference to member limited_vector - */ - eProsima_user_DllExport const std::vector& limited_vector() const; - - /*! - * @brief This function returns a reference to member limited_vector - * @return Reference to member limited_vector - */ - eProsima_user_DllExport std::vector& limited_vector(); - - - /*! - * @brief This function copies the value in member limited_array - * @param _limited_array New value to be copied in member limited_array - */ - eProsima_user_DllExport void limited_array( - const std::array& _limited_array); - - /*! - * @brief This function moves the value in member limited_array - * @param _limited_array New value to be moved in member limited_array - */ - eProsima_user_DllExport void limited_array( - std::array&& _limited_array); - - /*! - * @brief This function returns a constant reference to member limited_array - * @return Constant reference to member limited_array - */ - eProsima_user_DllExport const std::array& limited_array() const; - - /*! - * @brief This function returns a reference to member limited_array - * @return Reference to member limited_array - */ - eProsima_user_DllExport std::array& limited_array(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const arrays_and_sequences& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - std::vector m_unlimited_vector; - std::vector m_limited_vector; - std::array m_limited_array; - -}; - - -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_struct.cxx deleted file mode 100644 index fdd5905b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_struct.cxx +++ /dev/null @@ -1,287 +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 basic_array_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "basic_array_struct.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "basic_array_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -TheOtherObjectInArray::TheOtherObjectInArray() -{ - // Just to register all known types - registerbasic_array_structTypes(); -} - -TheOtherObjectInArray::~TheOtherObjectInArray() -{ -} - -TheOtherObjectInArray::TheOtherObjectInArray( - const TheOtherObjectInArray& x) -{ - m_some_num = x.m_some_num; - m_positive = x.m_positive; -} - -TheOtherObjectInArray::TheOtherObjectInArray( - TheOtherObjectInArray&& x) noexcept -{ - m_some_num = x.m_some_num; - m_positive = x.m_positive; -} - -TheOtherObjectInArray& TheOtherObjectInArray::operator =( - const TheOtherObjectInArray& x) -{ - - m_some_num = x.m_some_num; - m_positive = x.m_positive; - return *this; -} - -TheOtherObjectInArray& TheOtherObjectInArray::operator =( - TheOtherObjectInArray&& x) noexcept -{ - - m_some_num = x.m_some_num; - m_positive = x.m_positive; - return *this; -} - -bool TheOtherObjectInArray::operator ==( - const TheOtherObjectInArray& x) const -{ - return (m_some_num == x.m_some_num && - m_positive == x.m_positive); -} - -bool TheOtherObjectInArray::operator !=( - const TheOtherObjectInArray& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ -void TheOtherObjectInArray::some_num( - int32_t _some_num) -{ - m_some_num = _some_num; -} - -/*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ -int32_t TheOtherObjectInArray::some_num() const -{ - return m_some_num; -} - -/*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ -int32_t& TheOtherObjectInArray::some_num() -{ - return m_some_num; -} - - -/*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ -void TheOtherObjectInArray::positive( - bool _positive) -{ - m_positive = _positive; -} - -/*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ -bool TheOtherObjectInArray::positive() const -{ - return m_positive; -} - -/*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ -bool& TheOtherObjectInArray::positive() -{ - return m_positive; -} - - - - -basic_array_struct::basic_array_struct() -{ - // Just to register all known types - registerbasic_array_structTypes(); -} - -basic_array_struct::~basic_array_struct() -{ -} - -basic_array_struct::basic_array_struct( - const basic_array_struct& x) -{ - m_index = x.m_index; - m_sub_structs = x.m_sub_structs; -} - -basic_array_struct::basic_array_struct( - basic_array_struct&& x) noexcept -{ - m_index = x.m_index; - m_sub_structs = std::move(x.m_sub_structs); -} - -basic_array_struct& basic_array_struct::operator =( - const basic_array_struct& x) -{ - - m_index = x.m_index; - m_sub_structs = x.m_sub_structs; - return *this; -} - -basic_array_struct& basic_array_struct::operator =( - basic_array_struct&& x) noexcept -{ - - m_index = x.m_index; - m_sub_structs = std::move(x.m_sub_structs); - return *this; -} - -bool basic_array_struct::operator ==( - const basic_array_struct& x) const -{ - return (m_index == x.m_index && - m_sub_structs == x.m_sub_structs); -} - -bool basic_array_struct::operator !=( - const basic_array_struct& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void basic_array_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t basic_array_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& basic_array_struct::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member sub_structs - * @param _sub_structs New value to be copied in member sub_structs - */ -void basic_array_struct::sub_structs( - const std::array& _sub_structs) -{ - m_sub_structs = _sub_structs; -} - -/*! - * @brief This function moves the value in member sub_structs - * @param _sub_structs New value to be moved in member sub_structs - */ -void basic_array_struct::sub_structs( - std::array&& _sub_structs) -{ - m_sub_structs = std::move(_sub_structs); -} - -/*! - * @brief This function returns a constant reference to member sub_structs - * @return Constant reference to member sub_structs - */ -const std::array& basic_array_struct::sub_structs() const -{ - return m_sub_structs; -} - -/*! - * @brief This function returns a reference to member sub_structs - * @return Reference to member sub_structs - */ -std::array& basic_array_struct::sub_structs() -{ - return m_sub_structs; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "basic_array_structCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.cxx deleted file mode 100644 index 24fbff30..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.cxx +++ /dev/null @@ -1,481 +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 basic_array_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "basic_array_struct.h" -#include "basic_array_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerbasic_array_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("TheOtherObjectInArray", GetTheOtherObjectInArrayIdentifier(true), - GetTheOtherObjectInArrayObject(true)); - factory->add_type_object("TheOtherObjectInArray", GetTheOtherObjectInArrayIdentifier(false), - GetTheOtherObjectInArrayObject(false)); - - - factory->add_type_object("basic_array_struct", Getbasic_array_structIdentifier(true), - Getbasic_array_structObject(true)); - factory->add_type_object("basic_array_struct", Getbasic_array_structIdentifier(false), - Getbasic_array_structObject(false)); - - }); -} - - - -const TypeIdentifier* GetTheOtherObjectInArrayIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObjectInArray", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetTheOtherObjectInArrayObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObjectInArray", complete); -} - -const TypeObject* GetTheOtherObjectInArrayObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteTheOtherObjectInArrayObject(); - } - //else - return GetMinimalTheOtherObjectInArrayObject(); -} - -const TypeObject* GetMinimalTheOtherObjectInArrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_some_num; - mst_some_num.common().member_id(memberId++); - mst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_some_num.common().member_flags().IS_OPTIONAL(false); - mst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_some_num.common().member_flags().IS_KEY(false); - mst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - MD5 some_num_hash("some_num"); - for(int i = 0; i < 4; ++i) - { - mst_some_num.detail().name_hash()[i] = some_num_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_some_num); - - MinimalStructMember mst_positive; - mst_positive.common().member_id(memberId++); - mst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_positive.common().member_flags().IS_OPTIONAL(false); - mst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_positive.common().member_flags().IS_KEY(false); - mst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - MD5 positive_hash("positive"); - for(int i = 0; i < 4; ++i) - { - mst_positive.detail().name_hash()[i] = positive_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_positive); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObjectInArray", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", false); -} - -const TypeObject* GetCompleteTheOtherObjectInArrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_some_num; - cst_some_num.common().member_id(memberId++); - cst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_some_num.common().member_flags().IS_OPTIONAL(false); - cst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_some_num.common().member_flags().IS_KEY(false); - cst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - cst_some_num.detail().name("some_num"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_some_num); - - CompleteStructMember cst_positive; - cst_positive.common().member_id(memberId++); - cst_positive.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_positive.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_positive.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_positive.common().member_flags().IS_OPTIONAL(false); - cst_positive.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_positive.common().member_flags().IS_KEY(false); - cst_positive.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_positive.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("bool", false)); - - - cst_positive.detail().name("positive"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_positive); - - - // Header - type_object->complete().struct_type().header().detail().type_name("TheOtherObjectInArray"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObjectInArray", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObjectInArray", true); -} - - - -const TypeIdentifier* Getbasic_array_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("basic_array_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getbasic_array_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("basic_array_struct", complete); -} - -const TypeObject* Getbasic_array_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletebasic_array_structObject(); - } - //else - return GetMinimalbasic_array_structObject(); -} - -const TypeObject* GetMinimalbasic_array_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_sub_structs; - mst_sub_structs.common().member_id(memberId++); - mst_sub_structs.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_sub_structs.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_sub_structs.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_sub_structs.common().member_flags().IS_OPTIONAL(false); - mst_sub_structs.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_sub_structs.common().member_flags().IS_KEY(false); - mst_sub_structs.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_sub_structs.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("TheOtherObjectInArray", {5}, false)); - - MD5 sub_structs_hash("sub_structs"); - for(int i = 0; i < 4; ++i) - { - mst_sub_structs.detail().name_hash()[i] = sub_structs_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_sub_structs); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_array_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", false); -} - -const TypeObject* GetCompletebasic_array_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_sub_structs; - cst_sub_structs.common().member_id(memberId++); - cst_sub_structs.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_sub_structs.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_sub_structs.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_sub_structs.common().member_flags().IS_OPTIONAL(false); - cst_sub_structs.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_sub_structs.common().member_flags().IS_KEY(false); - cst_sub_structs.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_sub_structs.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("TheOtherObjectInArray", {5}, true)); - - cst_sub_structs.detail().name("sub_structs"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_sub_structs); - - - // Header - type_object->complete().struct_type().header().detail().type_name("basic_array_struct"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_array_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_array_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.h deleted file mode 100644 index 56633c05..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structTypeObject.h +++ /dev/null @@ -1,72 +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 basic_array_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(basic_array_struct_SOURCE) -#define basic_array_struct_DllAPI __declspec( dllexport ) -#else -#define basic_array_struct_DllAPI __declspec( dllimport ) -#endif // basic_array_struct_SOURCE -#else -#define basic_array_struct_DllAPI -#endif -#else -#define basic_array_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerbasic_array_structTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetTheOtherObjectInArrayIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetTheOtherObjectInArrayObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalTheOtherObjectInArrayObject(); -eProsima_user_DllExport const TypeObject* GetCompleteTheOtherObjectInArrayObject(); - - - -eProsima_user_DllExport const TypeIdentifier* Getbasic_array_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getbasic_array_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalbasic_array_structObject(); -eProsima_user_DllExport const TypeObject* GetCompletebasic_array_structObject(); - - -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.cxx deleted file mode 100644 index 89ebbf93..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.cxx +++ /dev/null @@ -1,486 +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 basic_array_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "basic_array_struct.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "basic_array_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define basic_array_struct_max_cdr_typesize 69ULL; -#define TheOtherObjectInArray_max_cdr_typesize 9ULL; - - - - -TheOtherObjectInArray::TheOtherObjectInArray() -{ - // long m_some_num - m_some_num = 0; - // boolean m_positive - m_positive = false; - - // Just to register all known types - registerbasic_array_structTypes(); -} - -TheOtherObjectInArray::~TheOtherObjectInArray() -{ -} - -TheOtherObjectInArray::TheOtherObjectInArray( - const TheOtherObjectInArray& x) -{ - m_some_num = x.m_some_num; - - - m_positive = x.m_positive; - -} - -TheOtherObjectInArray::TheOtherObjectInArray( - TheOtherObjectInArray&& x) noexcept -{ - m_some_num = x.m_some_num; - - - m_positive = x.m_positive; - -} - -TheOtherObjectInArray& TheOtherObjectInArray::operator =( - const TheOtherObjectInArray& x) -{ - m_some_num = x.m_some_num; - - - m_positive = x.m_positive; - - return *this; -} - -TheOtherObjectInArray& TheOtherObjectInArray::operator =( - TheOtherObjectInArray&& x) noexcept -{ - m_some_num = x.m_some_num; - - - m_positive = x.m_positive; - - return *this; -} - -bool TheOtherObjectInArray::operator ==( - const TheOtherObjectInArray& x) const -{ - return (m_some_num == x.m_some_num && - m_positive == x.m_positive); -} - -bool TheOtherObjectInArray::operator !=( - const TheOtherObjectInArray& x) const -{ - return !(*this == x); -} - -size_t TheOtherObjectInArray::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return TheOtherObjectInArray_max_cdr_typesize; -} - -size_t TheOtherObjectInArray::getCdrSerializedSize( - const TheOtherObjectInArray& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - return current_alignment - initial_alignment; -} - - -void TheOtherObjectInArray::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_some_num; - - scdr << m_positive; - -} - -void TheOtherObjectInArray::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_some_num; - - - - dcdr >> m_positive; - - -} - - -bool TheOtherObjectInArray::isKeyDefined() -{ - return false; -} - -void TheOtherObjectInArray::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ -void TheOtherObjectInArray::some_num( - int32_t _some_num) -{ - m_some_num = _some_num; -} - -/*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ -int32_t TheOtherObjectInArray::some_num() const -{ - return m_some_num; -} - -/*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ -int32_t& TheOtherObjectInArray::some_num() -{ - return m_some_num; -} - - -/*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ -void TheOtherObjectInArray::positive( - bool _positive) -{ - m_positive = _positive; -} - -/*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ -bool TheOtherObjectInArray::positive() const -{ - return m_positive; -} - -/*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ -bool& TheOtherObjectInArray::positive() -{ - return m_positive; -} - - - - - -basic_array_struct::basic_array_struct() -{ - // unsigned long m_index - m_index = 0; - // TheOtherObjectInArray m_sub_structs - - - // Just to register all known types - registerbasic_array_structTypes(); -} - -basic_array_struct::~basic_array_struct() -{ -} - -basic_array_struct::basic_array_struct( - const basic_array_struct& x) -{ - m_index = x.m_index; - - - m_sub_structs = x.m_sub_structs; - -} - -basic_array_struct::basic_array_struct( - basic_array_struct&& x) noexcept -{ - m_index = x.m_index; - - - m_sub_structs = std::move(x.m_sub_structs); - -} - -basic_array_struct& basic_array_struct::operator =( - const basic_array_struct& x) -{ - m_index = x.m_index; - - - m_sub_structs = x.m_sub_structs; - - return *this; -} - -basic_array_struct& basic_array_struct::operator =( - basic_array_struct&& x) noexcept -{ - m_index = x.m_index; - - - m_sub_structs = std::move(x.m_sub_structs); - - return *this; -} - -bool basic_array_struct::operator ==( - const basic_array_struct& x) const -{ - return (m_index == x.m_index && - m_sub_structs == x.m_sub_structs); -} - -bool basic_array_struct::operator !=( - const basic_array_struct& x) const -{ - return !(*this == x); -} - -size_t basic_array_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return basic_array_struct_max_cdr_typesize; -} - -size_t basic_array_struct::getCdrSerializedSize( - const basic_array_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - for(size_t a = 0; a < data.sub_structs().size(); ++a) - { - current_alignment += TheOtherObjectInArray::getCdrSerializedSize(data.sub_structs().at(a), current_alignment); - - } - - - - return current_alignment - initial_alignment; -} - - -void basic_array_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_index; - - scdr << m_sub_structs; - - -} - -void basic_array_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_index; - - - - dcdr >> m_sub_structs; - - -} - - -bool basic_array_struct::isKeyDefined() -{ - return false; -} - -void basic_array_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void basic_array_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t basic_array_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& basic_array_struct::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member sub_structs - * @param _sub_structs New value to be copied in member sub_structs - */ -void basic_array_struct::sub_structs( - const std::array& _sub_structs) -{ - m_sub_structs = _sub_structs; -} - -/*! - * @brief This function moves the value in member sub_structs - * @param _sub_structs New value to be moved in member sub_structs - */ -void basic_array_struct::sub_structs( - std::array&& _sub_structs) -{ - m_sub_structs = std::move(_sub_structs); -} - -/*! - * @brief This function returns a constant reference to member sub_structs - * @return Constant reference to member sub_structs - */ -const std::array& basic_array_struct::sub_structs() const -{ - return m_sub_structs; -} - -/*! - * @brief This function returns a reference to member sub_structs - * @return Reference to member sub_structs - */ -std::array& basic_array_struct::sub_structs() -{ - return m_sub_structs; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.h deleted file mode 100644 index 58c0a213..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_array_structv1.h +++ /dev/null @@ -1,403 +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 basic_array_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(BASIC_ARRAY_STRUCT_SOURCE) -#define BASIC_ARRAY_STRUCT_DllAPI __declspec( dllexport ) -#else -#define BASIC_ARRAY_STRUCT_DllAPI __declspec( dllimport ) -#endif // BASIC_ARRAY_STRUCT_SOURCE -#else -#define BASIC_ARRAY_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define BASIC_ARRAY_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure TheOtherObjectInArray defined by the user in the IDL file. - * @ingroup basic_array_struct - */ -class TheOtherObjectInArray -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport TheOtherObjectInArray(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~TheOtherObjectInArray(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray( - const TheOtherObjectInArray& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray( - TheOtherObjectInArray&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray& operator =( - const TheOtherObjectInArray& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray& operator =( - TheOtherObjectInArray&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x TheOtherObjectInArray object to compare. - */ - eProsima_user_DllExport bool operator ==( - const TheOtherObjectInArray& x) const; - - /*! - * @brief Comparison operator. - * @param x TheOtherObjectInArray object to compare. - */ - eProsima_user_DllExport bool operator !=( - const TheOtherObjectInArray& x) const; - - /*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ - eProsima_user_DllExport void some_num( - int32_t _some_num); - - /*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ - eProsima_user_DllExport int32_t some_num() const; - - /*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ - eProsima_user_DllExport int32_t& some_num(); - - - /*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ - eProsima_user_DllExport void positive( - bool _positive); - - /*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ - eProsima_user_DllExport bool positive() const; - - /*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ - eProsima_user_DllExport bool& positive(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const TheOtherObjectInArray& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - int32_t m_some_num; - bool m_positive; - -}; - - - -/*! - * @brief This class represents the structure basic_array_struct defined by the user in the IDL file. - * @ingroup basic_array_struct - */ -class basic_array_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport basic_array_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~basic_array_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct( - const basic_array_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct( - basic_array_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct& operator =( - const basic_array_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct& operator =( - basic_array_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x basic_array_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const basic_array_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x basic_array_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const basic_array_struct& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - - /*! - * @brief This function copies the value in member sub_structs - * @param _sub_structs New value to be copied in member sub_structs - */ - eProsima_user_DllExport void sub_structs( - const std::array& _sub_structs); - - /*! - * @brief This function moves the value in member sub_structs - * @param _sub_structs New value to be moved in member sub_structs - */ - eProsima_user_DllExport void sub_structs( - std::array&& _sub_structs); - - /*! - * @brief This function returns a constant reference to member sub_structs - * @return Constant reference to member sub_structs - */ - eProsima_user_DllExport const std::array& sub_structs() const; - - /*! - * @brief This function returns a reference to member sub_structs - * @return Reference to member sub_structs - */ - eProsima_user_DllExport std::array& sub_structs(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const basic_array_struct& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - uint32_t m_index; - std::array m_sub_structs; - -}; - - -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_struct.cxx deleted file mode 100644 index e97c666d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_struct.cxx +++ /dev/null @@ -1,219 +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 basic_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "basic_struct.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "basic_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -TheOtherObject::TheOtherObject() -{ - // Just to register all known types - registerbasic_structTypes(); -} - -TheOtherObject::~TheOtherObject() -{ -} - -TheOtherObject::TheOtherObject( - const TheOtherObject& x) -{ - m_some_num = x.m_some_num; -} - -TheOtherObject::TheOtherObject( - TheOtherObject&& x) noexcept -{ - m_some_num = x.m_some_num; -} - -TheOtherObject& TheOtherObject::operator =( - const TheOtherObject& x) -{ - - m_some_num = x.m_some_num; - return *this; -} - -TheOtherObject& TheOtherObject::operator =( - TheOtherObject&& x) noexcept -{ - - m_some_num = x.m_some_num; - return *this; -} - -bool TheOtherObject::operator ==( - const TheOtherObject& x) const -{ - return (m_some_num == x.m_some_num); -} - -bool TheOtherObject::operator !=( - const TheOtherObject& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ -void TheOtherObject::some_num( - int32_t _some_num) -{ - m_some_num = _some_num; -} - -/*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ -int32_t TheOtherObject::some_num() const -{ - return m_some_num; -} - -/*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ -int32_t& TheOtherObject::some_num() -{ - return m_some_num; -} - - - - -basic_struct::basic_struct() -{ - // Just to register all known types - registerbasic_structTypes(); -} - -basic_struct::~basic_struct() -{ -} - -basic_struct::basic_struct( - const basic_struct& x) -{ - m_sub_struct = x.m_sub_struct; -} - -basic_struct::basic_struct( - basic_struct&& x) noexcept -{ - m_sub_struct = std::move(x.m_sub_struct); -} - -basic_struct& basic_struct::operator =( - const basic_struct& x) -{ - - m_sub_struct = x.m_sub_struct; - return *this; -} - -basic_struct& basic_struct::operator =( - basic_struct&& x) noexcept -{ - - m_sub_struct = std::move(x.m_sub_struct); - return *this; -} - -bool basic_struct::operator ==( - const basic_struct& x) const -{ - return (m_sub_struct == x.m_sub_struct); -} - -bool basic_struct::operator !=( - const basic_struct& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member sub_struct - * @param _sub_struct New value to be copied in member sub_struct - */ -void basic_struct::sub_struct( - const TheOtherObject& _sub_struct) -{ - m_sub_struct = _sub_struct; -} - -/*! - * @brief This function moves the value in member sub_struct - * @param _sub_struct New value to be moved in member sub_struct - */ -void basic_struct::sub_struct( - TheOtherObject&& _sub_struct) -{ - m_sub_struct = std::move(_sub_struct); -} - -/*! - * @brief This function returns a constant reference to member sub_struct - * @return Constant reference to member sub_struct - */ -const TheOtherObject& basic_struct::sub_struct() const -{ - return m_sub_struct; -} - -/*! - * @brief This function returns a reference to member sub_struct - * @return Reference to member sub_struct - */ -TheOtherObject& basic_struct::sub_struct() -{ - return m_sub_struct; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "basic_structCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.cxx deleted file mode 100644 index f2c48c12..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.cxx +++ /dev/null @@ -1,411 +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 basic_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "basic_struct.h" -#include "basic_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerbasic_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("TheOtherObject", GetTheOtherObjectIdentifier(true), - GetTheOtherObjectObject(true)); - factory->add_type_object("TheOtherObject", GetTheOtherObjectIdentifier(false), - GetTheOtherObjectObject(false)); - - - factory->add_type_object("basic_struct", Getbasic_structIdentifier(true), - Getbasic_structObject(true)); - factory->add_type_object("basic_struct", Getbasic_structIdentifier(false), - Getbasic_structObject(false)); - - }); -} - - - -const TypeIdentifier* GetTheOtherObjectIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObject", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetTheOtherObjectObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("TheOtherObject", complete); -} - -const TypeObject* GetTheOtherObjectObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteTheOtherObjectObject(); - } - //else - return GetMinimalTheOtherObjectObject(); -} - -const TypeObject* GetMinimalTheOtherObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_some_num; - mst_some_num.common().member_id(memberId++); - mst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_some_num.common().member_flags().IS_OPTIONAL(false); - mst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_some_num.common().member_flags().IS_KEY(false); - mst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - MD5 some_num_hash("some_num"); - for(int i = 0; i < 4; ++i) - { - mst_some_num.detail().name_hash()[i] = some_num_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_some_num); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", false); -} - -const TypeObject* GetCompleteTheOtherObjectObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_some_num; - cst_some_num.common().member_id(memberId++); - cst_some_num.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_some_num.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_some_num.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_some_num.common().member_flags().IS_OPTIONAL(false); - cst_some_num.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_some_num.common().member_flags().IS_KEY(false); - cst_some_num.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_some_num.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - cst_some_num.detail().name("some_num"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_some_num); - - - // Header - type_object->complete().struct_type().header().detail().type_name("TheOtherObject"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("TheOtherObject", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("TheOtherObject", true); -} - - - -const TypeIdentifier* Getbasic_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("basic_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getbasic_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("basic_struct", complete); -} - -const TypeObject* Getbasic_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletebasic_structObject(); - } - //else - return GetMinimalbasic_structObject(); -} - -const TypeObject* GetMinimalbasic_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_sub_struct; - mst_sub_struct.common().member_id(memberId++); - mst_sub_struct.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_sub_struct.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_sub_struct.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_sub_struct.common().member_flags().IS_OPTIONAL(false); - mst_sub_struct.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_sub_struct.common().member_flags().IS_KEY(false); - mst_sub_struct.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_sub_struct.common().member_type_id(*GetTheOtherObjectIdentifier(false)); - - MD5 sub_struct_hash("sub_struct"); - for(int i = 0; i < 4; ++i) - { - mst_sub_struct.detail().name_hash()[i] = sub_struct_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_sub_struct); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_struct", false); -} - -const TypeObject* GetCompletebasic_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("basic_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_sub_struct; - cst_sub_struct.common().member_id(memberId++); - cst_sub_struct.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_sub_struct.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_sub_struct.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_sub_struct.common().member_flags().IS_OPTIONAL(false); - cst_sub_struct.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_sub_struct.common().member_flags().IS_KEY(false); - cst_sub_struct.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_sub_struct.common().member_type_id(*GetTheOtherObjectIdentifier(true)); - - cst_sub_struct.detail().name("sub_struct"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_sub_struct); - - - // Header - type_object->complete().struct_type().header().detail().type_name("basic_struct"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("basic_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("basic_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.h deleted file mode 100644 index 670cb315..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structTypeObject.h +++ /dev/null @@ -1,72 +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 basic_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(basic_struct_SOURCE) -#define basic_struct_DllAPI __declspec( dllexport ) -#else -#define basic_struct_DllAPI __declspec( dllimport ) -#endif // basic_struct_SOURCE -#else -#define basic_struct_DllAPI -#endif -#else -#define basic_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerbasic_structTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetTheOtherObjectIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetTheOtherObjectObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalTheOtherObjectObject(); -eProsima_user_DllExport const TypeObject* GetCompleteTheOtherObjectObject(); - - - -eProsima_user_DllExport const TypeIdentifier* Getbasic_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getbasic_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalbasic_structObject(); -eProsima_user_DllExport const TypeObject* GetCompletebasic_structObject(); - - -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.cxx deleted file mode 100644 index a485ca50..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.cxx +++ /dev/null @@ -1,373 +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 basic_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "basic_struct.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "basic_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define basic_struct_max_cdr_typesize 12ULL; -#define TheOtherObject_max_cdr_typesize 8ULL; - - - - -TheOtherObject::TheOtherObject() -{ - // long m_some_num - m_some_num = 0; - - // Just to register all known types - registerbasic_structTypes(); -} - -TheOtherObject::~TheOtherObject() -{ -} - -TheOtherObject::TheOtherObject( - const TheOtherObject& x) -{ - m_some_num = x.m_some_num; - -} - -TheOtherObject::TheOtherObject( - TheOtherObject&& x) noexcept -{ - m_some_num = x.m_some_num; - -} - -TheOtherObject& TheOtherObject::operator =( - const TheOtherObject& x) -{ - m_some_num = x.m_some_num; - - return *this; -} - -TheOtherObject& TheOtherObject::operator =( - TheOtherObject&& x) noexcept -{ - m_some_num = x.m_some_num; - - return *this; -} - -bool TheOtherObject::operator ==( - const TheOtherObject& x) const -{ - return (m_some_num == x.m_some_num); -} - -bool TheOtherObject::operator !=( - const TheOtherObject& x) const -{ - return !(*this == x); -} - -size_t TheOtherObject::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return TheOtherObject_max_cdr_typesize; -} - -size_t TheOtherObject::getCdrSerializedSize( - const TheOtherObject& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void TheOtherObject::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_some_num; - -} - -void TheOtherObject::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_some_num; - - -} - - -bool TheOtherObject::isKeyDefined() -{ - return false; -} - -void TheOtherObject::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ -void TheOtherObject::some_num( - int32_t _some_num) -{ - m_some_num = _some_num; -} - -/*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ -int32_t TheOtherObject::some_num() const -{ - return m_some_num; -} - -/*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ -int32_t& TheOtherObject::some_num() -{ - return m_some_num; -} - - - - - -basic_struct::basic_struct() -{ - // TheOtherObject m_sub_struct - - - // Just to register all known types - registerbasic_structTypes(); -} - -basic_struct::~basic_struct() -{ -} - -basic_struct::basic_struct( - const basic_struct& x) -{ - m_sub_struct = x.m_sub_struct; - -} - -basic_struct::basic_struct( - basic_struct&& x) noexcept -{ - m_sub_struct = std::move(x.m_sub_struct); - -} - -basic_struct& basic_struct::operator =( - const basic_struct& x) -{ - m_sub_struct = x.m_sub_struct; - - return *this; -} - -basic_struct& basic_struct::operator =( - basic_struct&& x) noexcept -{ - m_sub_struct = std::move(x.m_sub_struct); - - return *this; -} - -bool basic_struct::operator ==( - const basic_struct& x) const -{ - return (m_sub_struct == x.m_sub_struct); -} - -bool basic_struct::operator !=( - const basic_struct& x) const -{ - return !(*this == x); -} - -size_t basic_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return basic_struct_max_cdr_typesize; -} - -size_t basic_struct::getCdrSerializedSize( - const basic_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += TheOtherObject::getCdrSerializedSize(data.sub_struct(), current_alignment); - - - return current_alignment - initial_alignment; -} - - -void basic_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_sub_struct; - -} - -void basic_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_sub_struct; - - -} - - -bool basic_struct::isKeyDefined() -{ - return false; -} - -void basic_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member sub_struct - * @param _sub_struct New value to be copied in member sub_struct - */ -void basic_struct::sub_struct( - const TheOtherObject& _sub_struct) -{ - m_sub_struct = _sub_struct; -} - -/*! - * @brief This function moves the value in member sub_struct - * @param _sub_struct New value to be moved in member sub_struct - */ -void basic_struct::sub_struct( - TheOtherObject&& _sub_struct) -{ - m_sub_struct = std::move(_sub_struct); -} - -/*! - * @brief This function returns a constant reference to member sub_struct - * @return Constant reference to member sub_struct - */ -const TheOtherObject& basic_struct::sub_struct() const -{ - return m_sub_struct; -} - -/*! - * @brief This function returns a reference to member sub_struct - * @return Reference to member sub_struct - */ -TheOtherObject& basic_struct::sub_struct() -{ - return m_sub_struct; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.h deleted file mode 100644 index 2e1540cd..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/basic_structv1.h +++ /dev/null @@ -1,361 +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 basic_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_H_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(BASIC_STRUCT_SOURCE) -#define BASIC_STRUCT_DllAPI __declspec( dllexport ) -#else -#define BASIC_STRUCT_DllAPI __declspec( dllimport ) -#endif // BASIC_STRUCT_SOURCE -#else -#define BASIC_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define BASIC_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure TheOtherObject defined by the user in the IDL file. - * @ingroup basic_struct - */ -class TheOtherObject -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport TheOtherObject(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~TheOtherObject(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject( - const TheOtherObject& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject( - TheOtherObject&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject& operator =( - const TheOtherObject& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject& operator =( - TheOtherObject&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x TheOtherObject object to compare. - */ - eProsima_user_DllExport bool operator ==( - const TheOtherObject& x) const; - - /*! - * @brief Comparison operator. - * @param x TheOtherObject object to compare. - */ - eProsima_user_DllExport bool operator !=( - const TheOtherObject& x) const; - - /*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ - eProsima_user_DllExport void some_num( - int32_t _some_num); - - /*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ - eProsima_user_DllExport int32_t some_num() const; - - /*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ - eProsima_user_DllExport int32_t& some_num(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const TheOtherObject& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - int32_t m_some_num; - -}; - - - -/*! - * @brief This class represents the structure basic_struct defined by the user in the IDL file. - * @ingroup basic_struct - */ -class basic_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport basic_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~basic_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct( - const basic_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct( - basic_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct& operator =( - const basic_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct& operator =( - basic_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x basic_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const basic_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x basic_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const basic_struct& x) const; - - /*! - * @brief This function copies the value in member sub_struct - * @param _sub_struct New value to be copied in member sub_struct - */ - eProsima_user_DllExport void sub_struct( - const TheOtherObject& _sub_struct); - - /*! - * @brief This function moves the value in member sub_struct - * @param _sub_struct New value to be moved in member sub_struct - */ - eProsima_user_DllExport void sub_struct( - TheOtherObject&& _sub_struct); - - /*! - * @brief This function returns a constant reference to member sub_struct - * @return Constant reference to member sub_struct - */ - eProsima_user_DllExport const TheOtherObject& sub_struct() const; - - /*! - * @brief This function returns a reference to member sub_struct - * @return Reference to member sub_struct - */ - eProsima_user_DllExport TheOtherObject& sub_struct(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const basic_struct& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - TheOtherObject m_sub_struct; - -}; - - -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequence.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequence.cxx deleted file mode 100644 index 807a8835..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequence.cxx +++ /dev/null @@ -1,140 +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 char_sequence.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "char_sequence.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "char_sequenceTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - - - -char_sequence::char_sequence() -{ - // Just to register all known types - registerchar_sequenceTypes(); -} - -char_sequence::~char_sequence() -{ -} - -char_sequence::char_sequence( - const char_sequence& x) -{ - m_chars = x.m_chars; -} - -char_sequence::char_sequence( - char_sequence&& x) noexcept -{ - m_chars = std::move(x.m_chars); -} - -char_sequence& char_sequence::operator =( - const char_sequence& x) -{ - - m_chars = x.m_chars; - return *this; -} - -char_sequence& char_sequence::operator =( - char_sequence&& x) noexcept -{ - - m_chars = std::move(x.m_chars); - return *this; -} - -bool char_sequence::operator ==( - const char_sequence& x) const -{ - return (m_chars == x.m_chars); -} - -bool char_sequence::operator !=( - const char_sequence& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member chars - * @param _chars New value to be copied in member chars - */ -void char_sequence::chars( - const std::vector& _chars) -{ - m_chars = _chars; -} - -/*! - * @brief This function moves the value in member chars - * @param _chars New value to be moved in member chars - */ -void char_sequence::chars( - std::vector&& _chars) -{ - m_chars = std::move(_chars); -} - -/*! - * @brief This function returns a constant reference to member chars - * @return Constant reference to member chars - */ -const std::vector& char_sequence::chars() const -{ - return m_chars; -} - -/*! - * @brief This function returns a reference to member chars - * @return Reference to member chars - */ -std::vector& char_sequence::chars() -{ - return m_chars; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "char_sequenceCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.cxx deleted file mode 100644 index 77600c44..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.cxx +++ /dev/null @@ -1,230 +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 char_sequenceTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "char_sequence.h" -#include "char_sequenceTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerchar_sequenceTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("char_sequence", Getchar_sequenceIdentifier(true), - Getchar_sequenceObject(true)); - factory->add_type_object("char_sequence", Getchar_sequenceIdentifier(false), - Getchar_sequenceObject(false)); - - }); -} - - - - - -const TypeIdentifier* Getchar_sequenceIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("char_sequence", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getchar_sequenceObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("char_sequence", complete); -} - -const TypeObject* Getchar_sequenceObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("char_sequence", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletechar_sequenceObject(); - } - //else - return GetMinimalchar_sequenceObject(); -} - -const TypeObject* GetMinimalchar_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("char_sequence", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_chars; - mst_chars.common().member_id(memberId++); - mst_chars.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_chars.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_chars.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_chars.common().member_flags().IS_OPTIONAL(false); - mst_chars.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_chars.common().member_flags().IS_KEY(false); - mst_chars.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_chars.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("char", 0, false)); - - MD5 chars_hash("chars"); - for(int i = 0; i < 4; ++i) - { - mst_chars.detail().name_hash()[i] = chars_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_chars); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("char_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("char_sequence", false); -} - -const TypeObject* GetCompletechar_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("char_sequence", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_chars; - cst_chars.common().member_id(memberId++); - cst_chars.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_chars.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_chars.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_chars.common().member_flags().IS_OPTIONAL(false); - cst_chars.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_chars.common().member_flags().IS_KEY(false); - cst_chars.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_chars.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("char", 0, true)); - - cst_chars.detail().name("chars"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_chars); - - - // Header - type_object->complete().struct_type().header().detail().type_name("char_sequence"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("char_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("char_sequence", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.h deleted file mode 100644 index 4bcf2209..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequenceTypeObject.h +++ /dev/null @@ -1,67 +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 char_sequenceTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(char_sequence_SOURCE) -#define char_sequence_DllAPI __declspec( dllexport ) -#else -#define char_sequence_DllAPI __declspec( dllimport ) -#endif // char_sequence_SOURCE -#else -#define char_sequence_DllAPI -#endif -#else -#define char_sequence_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerchar_sequenceTypes(); - - - - - -eProsima_user_DllExport const TypeIdentifier* Getchar_sequenceIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getchar_sequenceObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalchar_sequenceObject(); -eProsima_user_DllExport const TypeObject* GetCompletechar_sequenceObject(); - - -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.cxx deleted file mode 100644 index dde0c072..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.cxx +++ /dev/null @@ -1,247 +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 char_sequence.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "char_sequence.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "char_sequenceTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define char_sequence_max_cdr_typesize 8ULL; - - - - - - -char_sequence::char_sequence() -{ - // sequence m_chars - - - // Just to register all known types - registerchar_sequenceTypes(); -} - -char_sequence::~char_sequence() -{ -} - -char_sequence::char_sequence( - const char_sequence& x) -{ - m_chars = x.m_chars; - -} - -char_sequence::char_sequence( - char_sequence&& x) noexcept -{ - m_chars = std::move(x.m_chars); - -} - -char_sequence& char_sequence::operator =( - const char_sequence& x) -{ - m_chars = x.m_chars; - - return *this; -} - -char_sequence& char_sequence::operator =( - char_sequence&& x) noexcept -{ - m_chars = std::move(x.m_chars); - - return *this; -} - -bool char_sequence::operator ==( - const char_sequence& x) const -{ - return (m_chars == x.m_chars); -} - -bool char_sequence::operator !=( - const char_sequence& x) const -{ - return !(*this == x); -} - -size_t char_sequence::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return char_sequence_max_cdr_typesize; -} - -size_t char_sequence::getCdrSerializedSize( - const char_sequence& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - if (data.chars().size() > 0) - { - current_alignment += (data.chars().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - } - - - - - return current_alignment - initial_alignment; -} - - -void char_sequence::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_chars; - - -} - -void char_sequence::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_chars; - - -} - - -bool char_sequence::isKeyDefined() -{ - return false; -} - -void char_sequence::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member chars - * @param _chars New value to be copied in member chars - */ -void char_sequence::chars( - const std::vector& _chars) -{ - m_chars = _chars; -} - -/*! - * @brief This function moves the value in member chars - * @param _chars New value to be moved in member chars - */ -void char_sequence::chars( - std::vector&& _chars) -{ - m_chars = std::move(_chars); -} - -/*! - * @brief This function returns a constant reference to member chars - * @return Constant reference to member chars - */ -const std::vector& char_sequence::chars() const -{ - return m_chars; -} - -/*! - * @brief This function returns a reference to member chars - * @return Reference to member chars - */ -std::vector& char_sequence::chars() -{ - return m_chars; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.h deleted file mode 100644 index d091c583..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/char_sequencev1.h +++ /dev/null @@ -1,224 +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 char_sequence.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(CHAR_SEQUENCE_SOURCE) -#define CHAR_SEQUENCE_DllAPI __declspec( dllexport ) -#else -#define CHAR_SEQUENCE_DllAPI __declspec( dllimport ) -#endif // CHAR_SEQUENCE_SOURCE -#else -#define CHAR_SEQUENCE_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define CHAR_SEQUENCE_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - - - -/*! - * @brief This class represents the structure char_sequence defined by the user in the IDL file. - * @ingroup char_sequence - */ -class char_sequence -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport char_sequence(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~char_sequence(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence( - const char_sequence& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence( - char_sequence&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence& operator =( - const char_sequence& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence& operator =( - char_sequence&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x char_sequence object to compare. - */ - eProsima_user_DllExport bool operator ==( - const char_sequence& x) const; - - /*! - * @brief Comparison operator. - * @param x char_sequence object to compare. - */ - eProsima_user_DllExport bool operator !=( - const char_sequence& x) const; - - /*! - * @brief This function copies the value in member chars - * @param _chars New value to be copied in member chars - */ - eProsima_user_DllExport void chars( - const std::vector& _chars); - - /*! - * @brief This function moves the value in member chars - * @param _chars New value to be moved in member chars - */ - eProsima_user_DllExport void chars( - std::vector&& _chars); - - /*! - * @brief This function returns a constant reference to member chars - * @return Constant reference to member chars - */ - eProsima_user_DllExport const std::vector& chars() const; - - /*! - * @brief This function returns a reference to member chars - * @return Reference to member chars - */ - eProsima_user_DllExport std::vector& chars(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const char_sequence& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - std::vector m_chars; - -}; - - -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arrays.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arrays.cxx deleted file mode 100644 index 278d065a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arrays.cxx +++ /dev/null @@ -1,569 +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 complex_nested_arrays.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "complex_nested_arrays.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "complex_nested_arraysTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -ThirdLevelElement::ThirdLevelElement() -{ - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -ThirdLevelElement::~ThirdLevelElement() -{ -} - -ThirdLevelElement::ThirdLevelElement( - const ThirdLevelElement& x) -{ - m_x = x.m_x; - m_y = x.m_y; -} - -ThirdLevelElement::ThirdLevelElement( - ThirdLevelElement&& x) noexcept -{ - m_x = x.m_x; - m_y = x.m_y; -} - -ThirdLevelElement& ThirdLevelElement::operator =( - const ThirdLevelElement& x) -{ - - m_x = x.m_x; - m_y = x.m_y; - return *this; -} - -ThirdLevelElement& ThirdLevelElement::operator =( - ThirdLevelElement&& x) noexcept -{ - - m_x = x.m_x; - m_y = x.m_y; - return *this; -} - -bool ThirdLevelElement::operator ==( - const ThirdLevelElement& x) const -{ - return (m_x == x.m_x && - m_y == x.m_y); -} - -bool ThirdLevelElement::operator !=( - const ThirdLevelElement& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ -void ThirdLevelElement::x( - double _x) -{ - m_x = _x; -} - -/*! - * @brief This function returns the value of member x - * @return Value of member x - */ -double ThirdLevelElement::x() const -{ - return m_x; -} - -/*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ -double& ThirdLevelElement::x() -{ - return m_x; -} - - -/*! - * @brief This function sets a value in member y - * @param _y New value for member y - */ -void ThirdLevelElement::y( - double _y) -{ - m_y = _y; -} - -/*! - * @brief This function returns the value of member y - * @return Value of member y - */ -double ThirdLevelElement::y() const -{ - return m_y; -} - -/*! - * @brief This function returns a reference to member y - * @return Reference to member y - */ -double& ThirdLevelElement::y() -{ - return m_y; -} - - - - - - -SecondLevelElement::SecondLevelElement() -{ - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -SecondLevelElement::~SecondLevelElement() -{ -} - -SecondLevelElement::SecondLevelElement( - const SecondLevelElement& x) -{ - m_an_element_alone = x.m_an_element_alone; - m_a_limited_other_value = x.m_a_limited_other_value; -} - -SecondLevelElement::SecondLevelElement( - SecondLevelElement&& x) noexcept -{ - m_an_element_alone = std::move(x.m_an_element_alone); - m_a_limited_other_value = std::move(x.m_a_limited_other_value); -} - -SecondLevelElement& SecondLevelElement::operator =( - const SecondLevelElement& x) -{ - - m_an_element_alone = x.m_an_element_alone; - m_a_limited_other_value = x.m_a_limited_other_value; - return *this; -} - -SecondLevelElement& SecondLevelElement::operator =( - SecondLevelElement&& x) noexcept -{ - - m_an_element_alone = std::move(x.m_an_element_alone); - m_a_limited_other_value = std::move(x.m_a_limited_other_value); - return *this; -} - -bool SecondLevelElement::operator ==( - const SecondLevelElement& x) const -{ - return (m_an_element_alone == x.m_an_element_alone && - m_a_limited_other_value == x.m_a_limited_other_value); -} - -bool SecondLevelElement::operator !=( - const SecondLevelElement& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ -void SecondLevelElement::an_element_alone( - const ThirdLevelElement& _an_element_alone) -{ - m_an_element_alone = _an_element_alone; -} - -/*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ -void SecondLevelElement::an_element_alone( - ThirdLevelElement&& _an_element_alone) -{ - m_an_element_alone = std::move(_an_element_alone); -} - -/*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ -const ThirdLevelElement& SecondLevelElement::an_element_alone() const -{ - return m_an_element_alone; -} - -/*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ -ThirdLevelElement& SecondLevelElement::an_element_alone() -{ - return m_an_element_alone; -} - - -/*! - * @brief This function copies the value in member a_limited_other_value - * @param _a_limited_other_value New value to be copied in member a_limited_other_value - */ -void SecondLevelElement::a_limited_other_value( - const std::vector& _a_limited_other_value) -{ - m_a_limited_other_value = _a_limited_other_value; -} - -/*! - * @brief This function moves the value in member a_limited_other_value - * @param _a_limited_other_value New value to be moved in member a_limited_other_value - */ -void SecondLevelElement::a_limited_other_value( - std::vector&& _a_limited_other_value) -{ - m_a_limited_other_value = std::move(_a_limited_other_value); -} - -/*! - * @brief This function returns a constant reference to member a_limited_other_value - * @return Constant reference to member a_limited_other_value - */ -const std::vector& SecondLevelElement::a_limited_other_value() const -{ - return m_a_limited_other_value; -} - -/*! - * @brief This function returns a reference to member a_limited_other_value - * @return Reference to member a_limited_other_value - */ -std::vector& SecondLevelElement::a_limited_other_value() -{ - return m_a_limited_other_value; -} - - - - -FirstLevelElement::FirstLevelElement() -{ - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -FirstLevelElement::~FirstLevelElement() -{ -} - -FirstLevelElement::FirstLevelElement( - const FirstLevelElement& x) -{ - m_useless_name = x.m_useless_name; - m_sub = x.m_sub; - m_an_element_alone = x.m_an_element_alone; -} - -FirstLevelElement::FirstLevelElement( - FirstLevelElement&& x) noexcept -{ - m_useless_name = std::move(x.m_useless_name); - m_sub = std::move(x.m_sub); - m_an_element_alone = std::move(x.m_an_element_alone); -} - -FirstLevelElement& FirstLevelElement::operator =( - const FirstLevelElement& x) -{ - - m_useless_name = x.m_useless_name; - m_sub = x.m_sub; - m_an_element_alone = x.m_an_element_alone; - return *this; -} - -FirstLevelElement& FirstLevelElement::operator =( - FirstLevelElement&& x) noexcept -{ - - m_useless_name = std::move(x.m_useless_name); - m_sub = std::move(x.m_sub); - m_an_element_alone = std::move(x.m_an_element_alone); - return *this; -} - -bool FirstLevelElement::operator ==( - const FirstLevelElement& x) const -{ - return (m_useless_name == x.m_useless_name && - m_sub == x.m_sub && - m_an_element_alone == x.m_an_element_alone); -} - -bool FirstLevelElement::operator !=( - const FirstLevelElement& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member useless_name - * @param _useless_name New value to be copied in member useless_name - */ -void FirstLevelElement::useless_name( - const std::string& _useless_name) -{ - m_useless_name = _useless_name; -} - -/*! - * @brief This function moves the value in member useless_name - * @param _useless_name New value to be moved in member useless_name - */ -void FirstLevelElement::useless_name( - std::string&& _useless_name) -{ - m_useless_name = std::move(_useless_name); -} - -/*! - * @brief This function returns a constant reference to member useless_name - * @return Constant reference to member useless_name - */ -const std::string& FirstLevelElement::useless_name() const -{ - return m_useless_name; -} - -/*! - * @brief This function returns a reference to member useless_name - * @return Reference to member useless_name - */ -std::string& FirstLevelElement::useless_name() -{ - return m_useless_name; -} - - -/*! - * @brief This function copies the value in member sub - * @param _sub New value to be copied in member sub - */ -void FirstLevelElement::sub( - const std::vector& _sub) -{ - m_sub = _sub; -} - -/*! - * @brief This function moves the value in member sub - * @param _sub New value to be moved in member sub - */ -void FirstLevelElement::sub( - std::vector&& _sub) -{ - m_sub = std::move(_sub); -} - -/*! - * @brief This function returns a constant reference to member sub - * @return Constant reference to member sub - */ -const std::vector& FirstLevelElement::sub() const -{ - return m_sub; -} - -/*! - * @brief This function returns a reference to member sub - * @return Reference to member sub - */ -std::vector& FirstLevelElement::sub() -{ - return m_sub; -} - - -/*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ -void FirstLevelElement::an_element_alone( - const ThirdLevelElement& _an_element_alone) -{ - m_an_element_alone = _an_element_alone; -} - -/*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ -void FirstLevelElement::an_element_alone( - ThirdLevelElement&& _an_element_alone) -{ - m_an_element_alone = std::move(_an_element_alone); -} - -/*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ -const ThirdLevelElement& FirstLevelElement::an_element_alone() const -{ - return m_an_element_alone; -} - -/*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ -ThirdLevelElement& FirstLevelElement::an_element_alone() -{ - return m_an_element_alone; -} - - - - -complex_nested_arrays::complex_nested_arrays() -{ - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -complex_nested_arrays::~complex_nested_arrays() -{ -} - -complex_nested_arrays::complex_nested_arrays( - const complex_nested_arrays& x) -{ - m_array_of_elements = x.m_array_of_elements; -} - -complex_nested_arrays::complex_nested_arrays( - complex_nested_arrays&& x) noexcept -{ - m_array_of_elements = std::move(x.m_array_of_elements); -} - -complex_nested_arrays& complex_nested_arrays::operator =( - const complex_nested_arrays& x) -{ - - m_array_of_elements = x.m_array_of_elements; - return *this; -} - -complex_nested_arrays& complex_nested_arrays::operator =( - complex_nested_arrays&& x) noexcept -{ - - m_array_of_elements = std::move(x.m_array_of_elements); - return *this; -} - -bool complex_nested_arrays::operator ==( - const complex_nested_arrays& x) const -{ - return (m_array_of_elements == x.m_array_of_elements); -} - -bool complex_nested_arrays::operator !=( - const complex_nested_arrays& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member array_of_elements - * @param _array_of_elements New value to be copied in member array_of_elements - */ -void complex_nested_arrays::array_of_elements( - const std::array& _array_of_elements) -{ - m_array_of_elements = _array_of_elements; -} - -/*! - * @brief This function moves the value in member array_of_elements - * @param _array_of_elements New value to be moved in member array_of_elements - */ -void complex_nested_arrays::array_of_elements( - std::array&& _array_of_elements) -{ - m_array_of_elements = std::move(_array_of_elements); -} - -/*! - * @brief This function returns a constant reference to member array_of_elements - * @return Constant reference to member array_of_elements - */ -const std::array& complex_nested_arrays::array_of_elements() const -{ - return m_array_of_elements; -} - -/*! - * @brief This function returns a reference to member array_of_elements - * @return Reference to member array_of_elements - */ -std::array& complex_nested_arrays::array_of_elements() -{ - return m_array_of_elements; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "complex_nested_arraysCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.cxx deleted file mode 100644 index c26317f6..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.cxx +++ /dev/null @@ -1,909 +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 complex_nested_arraysTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "complex_nested_arrays.h" -#include "complex_nested_arraysTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registercomplex_nested_arraysTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("ThirdLevelElement", GetThirdLevelElementIdentifier(true), - GetThirdLevelElementObject(true)); - factory->add_type_object("ThirdLevelElement", GetThirdLevelElementIdentifier(false), - GetThirdLevelElementObject(false)); - - - factory->add_type_object("SecondLevelElement", GetSecondLevelElementIdentifier(true), - GetSecondLevelElementObject(true)); - factory->add_type_object("SecondLevelElement", GetSecondLevelElementIdentifier(false), - GetSecondLevelElementObject(false)); - - - factory->add_type_object("FirstLevelElement", GetFirstLevelElementIdentifier(true), - GetFirstLevelElementObject(true)); - factory->add_type_object("FirstLevelElement", GetFirstLevelElementIdentifier(false), - GetFirstLevelElementObject(false)); - - - factory->add_type_object("complex_nested_arrays", Getcomplex_nested_arraysIdentifier(true), - Getcomplex_nested_arraysObject(true)); - factory->add_type_object("complex_nested_arrays", Getcomplex_nested_arraysIdentifier(false), - Getcomplex_nested_arraysObject(false)); - - }); -} - - - -const TypeIdentifier* GetThirdLevelElementIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("ThirdLevelElement", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetThirdLevelElementObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("ThirdLevelElement", complete); -} - -const TypeObject* GetThirdLevelElementObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteThirdLevelElementObject(); - } - //else - return GetMinimalThirdLevelElementObject(); -} - -const TypeObject* GetMinimalThirdLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_x; - mst_x.common().member_id(memberId++); - mst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_x.common().member_flags().IS_OPTIONAL(false); - mst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_x.common().member_flags().IS_KEY(false); - mst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - - MD5 x_hash("x"); - for(int i = 0; i < 4; ++i) - { - mst_x.detail().name_hash()[i] = x_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_x); - - MinimalStructMember mst_y; - mst_y.common().member_id(memberId++); - mst_y.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_y.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_y.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_y.common().member_flags().IS_OPTIONAL(false); - mst_y.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_y.common().member_flags().IS_KEY(false); - mst_y.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_y.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - - MD5 y_hash("y"); - for(int i = 0; i < 4; ++i) - { - mst_y.detail().name_hash()[i] = y_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_y); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ThirdLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", false); -} - -const TypeObject* GetCompleteThirdLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_x; - cst_x.common().member_id(memberId++); - cst_x.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_x.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_x.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_x.common().member_flags().IS_OPTIONAL(false); - cst_x.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_x.common().member_flags().IS_KEY(false); - cst_x.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_x.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - - cst_x.detail().name("x"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_x); - - CompleteStructMember cst_y; - cst_y.common().member_id(memberId++); - cst_y.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_y.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_y.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_y.common().member_flags().IS_OPTIONAL(false); - cst_y.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_y.common().member_flags().IS_KEY(false); - cst_y.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_y.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("double", false)); - - - cst_y.detail().name("y"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_y); - - - // Header - type_object->complete().struct_type().header().detail().type_name("ThirdLevelElement"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ThirdLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ThirdLevelElement", true); -} - - - - - -const TypeIdentifier* GetSecondLevelElementIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("SecondLevelElement", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetSecondLevelElementObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("SecondLevelElement", complete); -} - -const TypeObject* GetSecondLevelElementObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteSecondLevelElementObject(); - } - //else - return GetMinimalSecondLevelElementObject(); -} - -const TypeObject* GetMinimalSecondLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_an_element_alone; - mst_an_element_alone.common().member_id(memberId++); - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - mst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_an_element_alone.common().member_flags().IS_KEY(false); - mst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(false)); - - MD5 an_element_alone_hash("an_element_alone"); - for(int i = 0; i < 4; ++i) - { - mst_an_element_alone.detail().name_hash()[i] = an_element_alone_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_an_element_alone); - - MinimalStructMember mst_a_limited_other_value; - mst_a_limited_other_value.common().member_id(memberId++); - mst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_a_limited_other_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_a_limited_other_value.common().member_flags().IS_OPTIONAL(false); - mst_a_limited_other_value.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_a_limited_other_value.common().member_flags().IS_KEY(false); - mst_a_limited_other_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_a_limited_other_value.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("ThirdLevelElement", 1, false)); - - MD5 a_limited_other_value_hash("a_limited_other_value"); - for(int i = 0; i < 4; ++i) - { - mst_a_limited_other_value.detail().name_hash()[i] = a_limited_other_value_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_a_limited_other_value); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("SecondLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", false); -} - -const TypeObject* GetCompleteSecondLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_an_element_alone; - cst_an_element_alone.common().member_id(memberId++); - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - cst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_an_element_alone.common().member_flags().IS_KEY(false); - cst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(true)); - - cst_an_element_alone.detail().name("an_element_alone"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_an_element_alone); - - CompleteStructMember cst_a_limited_other_value; - cst_a_limited_other_value.common().member_id(memberId++); - cst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_a_limited_other_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_a_limited_other_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_a_limited_other_value.common().member_flags().IS_OPTIONAL(false); - cst_a_limited_other_value.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_a_limited_other_value.common().member_flags().IS_KEY(false); - cst_a_limited_other_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_a_limited_other_value.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("ThirdLevelElement", 1, true)); - - cst_a_limited_other_value.detail().name("a_limited_other_value"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_a_limited_other_value); - - - // Header - type_object->complete().struct_type().header().detail().type_name("SecondLevelElement"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("SecondLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("SecondLevelElement", true); -} - - - -const TypeIdentifier* GetFirstLevelElementIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("FirstLevelElement", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetFirstLevelElementObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("FirstLevelElement", complete); -} - -const TypeObject* GetFirstLevelElementObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteFirstLevelElementObject(); - } - //else - return GetMinimalFirstLevelElementObject(); -} - -const TypeObject* GetMinimalFirstLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_useless_name; - mst_useless_name.common().member_id(memberId++); - mst_useless_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_useless_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_useless_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_useless_name.common().member_flags().IS_OPTIONAL(false); - mst_useless_name.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_useless_name.common().member_flags().IS_KEY(false); - mst_useless_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_useless_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 useless_name_hash("useless_name"); - for(int i = 0; i < 4; ++i) - { - mst_useless_name.detail().name_hash()[i] = useless_name_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_useless_name); - - MinimalStructMember mst_sub; - mst_sub.common().member_id(memberId++); - mst_sub.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_sub.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_sub.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_sub.common().member_flags().IS_OPTIONAL(false); - mst_sub.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_sub.common().member_flags().IS_KEY(false); - mst_sub.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_sub.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("SecondLevelElement", 0, false)); - - MD5 sub_hash("sub"); - for(int i = 0; i < 4; ++i) - { - mst_sub.detail().name_hash()[i] = sub_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_sub); - - MinimalStructMember mst_an_element_alone; - mst_an_element_alone.common().member_id(memberId++); - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - mst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_an_element_alone.common().member_flags().IS_KEY(false); - mst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(false)); - - MD5 an_element_alone_hash("an_element_alone"); - for(int i = 0; i < 4; ++i) - { - mst_an_element_alone.detail().name_hash()[i] = an_element_alone_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_an_element_alone); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("FirstLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", false); -} - -const TypeObject* GetCompleteFirstLevelElementObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_useless_name; - cst_useless_name.common().member_id(memberId++); - cst_useless_name.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_useless_name.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_useless_name.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_useless_name.common().member_flags().IS_OPTIONAL(false); - cst_useless_name.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_useless_name.common().member_flags().IS_KEY(false); - cst_useless_name.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_useless_name.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_useless_name.detail().name("useless_name"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_useless_name); - - CompleteStructMember cst_sub; - cst_sub.common().member_id(memberId++); - cst_sub.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_sub.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_sub.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_sub.common().member_flags().IS_OPTIONAL(false); - cst_sub.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_sub.common().member_flags().IS_KEY(false); - cst_sub.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_sub.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("SecondLevelElement", 0, true)); - - cst_sub.detail().name("sub"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_sub); - - CompleteStructMember cst_an_element_alone; - cst_an_element_alone.common().member_id(memberId++); - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_an_element_alone.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_an_element_alone.common().member_flags().IS_OPTIONAL(false); - cst_an_element_alone.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_an_element_alone.common().member_flags().IS_KEY(false); - cst_an_element_alone.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_an_element_alone.common().member_type_id(*GetThirdLevelElementIdentifier(true)); - - cst_an_element_alone.detail().name("an_element_alone"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_an_element_alone); - - - // Header - type_object->complete().struct_type().header().detail().type_name("FirstLevelElement"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("FirstLevelElement", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("FirstLevelElement", true); -} - - - -const TypeIdentifier* Getcomplex_nested_arraysIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("complex_nested_arrays", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getcomplex_nested_arraysObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("complex_nested_arrays", complete); -} - -const TypeObject* Getcomplex_nested_arraysObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletecomplex_nested_arraysObject(); - } - //else - return GetMinimalcomplex_nested_arraysObject(); -} - -const TypeObject* GetMinimalcomplex_nested_arraysObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_array_of_elements; - mst_array_of_elements.common().member_id(memberId++); - mst_array_of_elements.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_array_of_elements.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_array_of_elements.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_array_of_elements.common().member_flags().IS_OPTIONAL(false); - mst_array_of_elements.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_array_of_elements.common().member_flags().IS_KEY(false); - mst_array_of_elements.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_array_of_elements.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("FirstLevelElement", {3}, false)); - - MD5 array_of_elements_hash("array_of_elements"); - for(int i = 0; i < 4; ++i) - { - mst_array_of_elements.detail().name_hash()[i] = array_of_elements_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_array_of_elements); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("complex_nested_arrays", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", false); -} - -const TypeObject* GetCompletecomplex_nested_arraysObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_array_of_elements; - cst_array_of_elements.common().member_id(memberId++); - cst_array_of_elements.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_array_of_elements.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_array_of_elements.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_array_of_elements.common().member_flags().IS_OPTIONAL(false); - cst_array_of_elements.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_array_of_elements.common().member_flags().IS_KEY(false); - cst_array_of_elements.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_array_of_elements.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("FirstLevelElement", {3}, true)); - - cst_array_of_elements.detail().name("array_of_elements"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_array_of_elements); - - - // Header - type_object->complete().struct_type().header().detail().type_name("complex_nested_arrays"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("complex_nested_arrays", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("complex_nested_arrays", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.h deleted file mode 100644 index 96d8e29e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysTypeObject.h +++ /dev/null @@ -1,88 +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 complex_nested_arraysTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(complex_nested_arrays_SOURCE) -#define complex_nested_arrays_DllAPI __declspec( dllexport ) -#else -#define complex_nested_arrays_DllAPI __declspec( dllimport ) -#endif // complex_nested_arrays_SOURCE -#else -#define complex_nested_arrays_DllAPI -#endif -#else -#define complex_nested_arrays_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registercomplex_nested_arraysTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetThirdLevelElementIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetThirdLevelElementObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalThirdLevelElementObject(); -eProsima_user_DllExport const TypeObject* GetCompleteThirdLevelElementObject(); - - - - - -eProsima_user_DllExport const TypeIdentifier* GetSecondLevelElementIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetSecondLevelElementObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalSecondLevelElementObject(); -eProsima_user_DllExport const TypeObject* GetCompleteSecondLevelElementObject(); - - - -eProsima_user_DllExport const TypeIdentifier* GetFirstLevelElementIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetFirstLevelElementObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalFirstLevelElementObject(); -eProsima_user_DllExport const TypeObject* GetCompleteFirstLevelElementObject(); - - - -eProsima_user_DllExport const TypeIdentifier* Getcomplex_nested_arraysIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getcomplex_nested_arraysObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalcomplex_nested_arraysObject(); -eProsima_user_DllExport const TypeObject* GetCompletecomplex_nested_arraysObject(); - - -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.cxx deleted file mode 100644 index afac5ea1..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.cxx +++ /dev/null @@ -1,932 +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 complex_nested_arrays.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "complex_nested_arrays.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "complex_nested_arraysTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define FirstLevelElement_max_cdr_typesize 296ULL; -#define ThirdLevelElement_max_cdr_typesize 24ULL; -#define SecondLevelElement_max_cdr_typesize 56ULL; -#define complex_nested_arrays_max_cdr_typesize 896ULL; - - - - -ThirdLevelElement::ThirdLevelElement() -{ - // double m_x - m_x = 0.0; - // double m_y - m_y = 0.0; - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -ThirdLevelElement::~ThirdLevelElement() -{ -} - -ThirdLevelElement::ThirdLevelElement( - const ThirdLevelElement& x) -{ - m_x = x.m_x; - - - m_y = x.m_y; - -} - -ThirdLevelElement::ThirdLevelElement( - ThirdLevelElement&& x) noexcept -{ - m_x = x.m_x; - - - m_y = x.m_y; - -} - -ThirdLevelElement& ThirdLevelElement::operator =( - const ThirdLevelElement& x) -{ - m_x = x.m_x; - - - m_y = x.m_y; - - return *this; -} - -ThirdLevelElement& ThirdLevelElement::operator =( - ThirdLevelElement&& x) noexcept -{ - m_x = x.m_x; - - - m_y = x.m_y; - - return *this; -} - -bool ThirdLevelElement::operator ==( - const ThirdLevelElement& x) const -{ - return (m_x == x.m_x && - m_y == x.m_y); -} - -bool ThirdLevelElement::operator !=( - const ThirdLevelElement& x) const -{ - return !(*this == x); -} - -size_t ThirdLevelElement::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return ThirdLevelElement_max_cdr_typesize; -} - -size_t ThirdLevelElement::getCdrSerializedSize( - const ThirdLevelElement& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - return current_alignment - initial_alignment; -} - - -void ThirdLevelElement::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_x; - - scdr << m_y; - -} - -void ThirdLevelElement::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_x; - - - - dcdr >> m_y; - - -} - - -bool ThirdLevelElement::isKeyDefined() -{ - return false; -} - -void ThirdLevelElement::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ -void ThirdLevelElement::x( - double _x) -{ - m_x = _x; -} - -/*! - * @brief This function returns the value of member x - * @return Value of member x - */ -double ThirdLevelElement::x() const -{ - return m_x; -} - -/*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ -double& ThirdLevelElement::x() -{ - return m_x; -} - - -/*! - * @brief This function sets a value in member y - * @param _y New value for member y - */ -void ThirdLevelElement::y( - double _y) -{ - m_y = _y; -} - -/*! - * @brief This function returns the value of member y - * @return Value of member y - */ -double ThirdLevelElement::y() const -{ - return m_y; -} - -/*! - * @brief This function returns a reference to member y - * @return Reference to member y - */ -double& ThirdLevelElement::y() -{ - return m_y; -} - - - - - - - -SecondLevelElement::SecondLevelElement() -{ - // ThirdLevelElement m_an_element_alone - - // sequence m_a_limited_other_value - - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -SecondLevelElement::~SecondLevelElement() -{ -} - -SecondLevelElement::SecondLevelElement( - const SecondLevelElement& x) -{ - m_an_element_alone = x.m_an_element_alone; - - - m_a_limited_other_value = x.m_a_limited_other_value; - -} - -SecondLevelElement::SecondLevelElement( - SecondLevelElement&& x) noexcept -{ - m_an_element_alone = std::move(x.m_an_element_alone); - - - m_a_limited_other_value = std::move(x.m_a_limited_other_value); - -} - -SecondLevelElement& SecondLevelElement::operator =( - const SecondLevelElement& x) -{ - m_an_element_alone = x.m_an_element_alone; - - - m_a_limited_other_value = x.m_a_limited_other_value; - - return *this; -} - -SecondLevelElement& SecondLevelElement::operator =( - SecondLevelElement&& x) noexcept -{ - m_an_element_alone = std::move(x.m_an_element_alone); - - - m_a_limited_other_value = std::move(x.m_a_limited_other_value); - - return *this; -} - -bool SecondLevelElement::operator ==( - const SecondLevelElement& x) const -{ - return (m_an_element_alone == x.m_an_element_alone && - m_a_limited_other_value == x.m_a_limited_other_value); -} - -bool SecondLevelElement::operator !=( - const SecondLevelElement& x) const -{ - return !(*this == x); -} - -size_t SecondLevelElement::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return SecondLevelElement_max_cdr_typesize; -} - -size_t SecondLevelElement::getCdrSerializedSize( - const SecondLevelElement& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += ThirdLevelElement::getCdrSerializedSize(data.an_element_alone(), current_alignment); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.a_limited_other_value().size(); ++a) - { - current_alignment += ThirdLevelElement::getCdrSerializedSize(data.a_limited_other_value().at(a), current_alignment); - } - - - - return current_alignment - initial_alignment; -} - - -void SecondLevelElement::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_an_element_alone; - - scdr << m_a_limited_other_value; - - -} - -void SecondLevelElement::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_an_element_alone; - - - - dcdr >> m_a_limited_other_value; - - -} - - -bool SecondLevelElement::isKeyDefined() -{ - return false; -} - -void SecondLevelElement::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ -void SecondLevelElement::an_element_alone( - const ThirdLevelElement& _an_element_alone) -{ - m_an_element_alone = _an_element_alone; -} - -/*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ -void SecondLevelElement::an_element_alone( - ThirdLevelElement&& _an_element_alone) -{ - m_an_element_alone = std::move(_an_element_alone); -} - -/*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ -const ThirdLevelElement& SecondLevelElement::an_element_alone() const -{ - return m_an_element_alone; -} - -/*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ -ThirdLevelElement& SecondLevelElement::an_element_alone() -{ - return m_an_element_alone; -} - - -/*! - * @brief This function copies the value in member a_limited_other_value - * @param _a_limited_other_value New value to be copied in member a_limited_other_value - */ -void SecondLevelElement::a_limited_other_value( - const std::vector& _a_limited_other_value) -{ - m_a_limited_other_value = _a_limited_other_value; -} - -/*! - * @brief This function moves the value in member a_limited_other_value - * @param _a_limited_other_value New value to be moved in member a_limited_other_value - */ -void SecondLevelElement::a_limited_other_value( - std::vector&& _a_limited_other_value) -{ - m_a_limited_other_value = std::move(_a_limited_other_value); -} - -/*! - * @brief This function returns a constant reference to member a_limited_other_value - * @return Constant reference to member a_limited_other_value - */ -const std::vector& SecondLevelElement::a_limited_other_value() const -{ - return m_a_limited_other_value; -} - -/*! - * @brief This function returns a reference to member a_limited_other_value - * @return Reference to member a_limited_other_value - */ -std::vector& SecondLevelElement::a_limited_other_value() -{ - return m_a_limited_other_value; -} - - - - - -FirstLevelElement::FirstLevelElement() -{ - // /type_d() m_useless_name - - // sequence m_sub - - // ThirdLevelElement m_an_element_alone - - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -FirstLevelElement::~FirstLevelElement() -{ -} - -FirstLevelElement::FirstLevelElement( - const FirstLevelElement& x) -{ - m_useless_name = x.m_useless_name; - - - m_sub = x.m_sub; - - - m_an_element_alone = x.m_an_element_alone; - -} - -FirstLevelElement::FirstLevelElement( - FirstLevelElement&& x) noexcept -{ - m_useless_name = std::move(x.m_useless_name); - - - m_sub = std::move(x.m_sub); - - - m_an_element_alone = std::move(x.m_an_element_alone); - -} - -FirstLevelElement& FirstLevelElement::operator =( - const FirstLevelElement& x) -{ - m_useless_name = x.m_useless_name; - - - m_sub = x.m_sub; - - - m_an_element_alone = x.m_an_element_alone; - - return *this; -} - -FirstLevelElement& FirstLevelElement::operator =( - FirstLevelElement&& x) noexcept -{ - m_useless_name = std::move(x.m_useless_name); - - - m_sub = std::move(x.m_sub); - - - m_an_element_alone = std::move(x.m_an_element_alone); - - return *this; -} - -bool FirstLevelElement::operator ==( - const FirstLevelElement& x) const -{ - return (m_useless_name == x.m_useless_name && - m_sub == x.m_sub && - m_an_element_alone == x.m_an_element_alone); -} - -bool FirstLevelElement::operator !=( - const FirstLevelElement& x) const -{ - return !(*this == x); -} - -size_t FirstLevelElement::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return FirstLevelElement_max_cdr_typesize; -} - -size_t FirstLevelElement::getCdrSerializedSize( - const FirstLevelElement& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.useless_name().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.sub().size(); ++a) - { - current_alignment += SecondLevelElement::getCdrSerializedSize(data.sub().at(a), current_alignment); - } - - - - current_alignment += ThirdLevelElement::getCdrSerializedSize(data.an_element_alone(), current_alignment); - - - return current_alignment - initial_alignment; -} - - -void FirstLevelElement::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_useless_name.c_str(); - - scdr << m_sub; - - - scdr << m_an_element_alone; - -} - -void FirstLevelElement::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_useless_name; - - - - dcdr >> m_sub; - - - - dcdr >> m_an_element_alone; - - -} - - -bool FirstLevelElement::isKeyDefined() -{ - return false; -} - -void FirstLevelElement::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member useless_name - * @param _useless_name New value to be copied in member useless_name - */ -void FirstLevelElement::useless_name( - const std::string& _useless_name) -{ - m_useless_name = _useless_name; -} - -/*! - * @brief This function moves the value in member useless_name - * @param _useless_name New value to be moved in member useless_name - */ -void FirstLevelElement::useless_name( - std::string&& _useless_name) -{ - m_useless_name = std::move(_useless_name); -} - -/*! - * @brief This function returns a constant reference to member useless_name - * @return Constant reference to member useless_name - */ -const std::string& FirstLevelElement::useless_name() const -{ - return m_useless_name; -} - -/*! - * @brief This function returns a reference to member useless_name - * @return Reference to member useless_name - */ -std::string& FirstLevelElement::useless_name() -{ - return m_useless_name; -} - - -/*! - * @brief This function copies the value in member sub - * @param _sub New value to be copied in member sub - */ -void FirstLevelElement::sub( - const std::vector& _sub) -{ - m_sub = _sub; -} - -/*! - * @brief This function moves the value in member sub - * @param _sub New value to be moved in member sub - */ -void FirstLevelElement::sub( - std::vector&& _sub) -{ - m_sub = std::move(_sub); -} - -/*! - * @brief This function returns a constant reference to member sub - * @return Constant reference to member sub - */ -const std::vector& FirstLevelElement::sub() const -{ - return m_sub; -} - -/*! - * @brief This function returns a reference to member sub - * @return Reference to member sub - */ -std::vector& FirstLevelElement::sub() -{ - return m_sub; -} - - -/*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ -void FirstLevelElement::an_element_alone( - const ThirdLevelElement& _an_element_alone) -{ - m_an_element_alone = _an_element_alone; -} - -/*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ -void FirstLevelElement::an_element_alone( - ThirdLevelElement&& _an_element_alone) -{ - m_an_element_alone = std::move(_an_element_alone); -} - -/*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ -const ThirdLevelElement& FirstLevelElement::an_element_alone() const -{ - return m_an_element_alone; -} - -/*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ -ThirdLevelElement& FirstLevelElement::an_element_alone() -{ - return m_an_element_alone; -} - - - - - -complex_nested_arrays::complex_nested_arrays() -{ - // FirstLevelElement m_array_of_elements - - - // Just to register all known types - registercomplex_nested_arraysTypes(); -} - -complex_nested_arrays::~complex_nested_arrays() -{ -} - -complex_nested_arrays::complex_nested_arrays( - const complex_nested_arrays& x) -{ - m_array_of_elements = x.m_array_of_elements; - -} - -complex_nested_arrays::complex_nested_arrays( - complex_nested_arrays&& x) noexcept -{ - m_array_of_elements = std::move(x.m_array_of_elements); - -} - -complex_nested_arrays& complex_nested_arrays::operator =( - const complex_nested_arrays& x) -{ - m_array_of_elements = x.m_array_of_elements; - - return *this; -} - -complex_nested_arrays& complex_nested_arrays::operator =( - complex_nested_arrays&& x) noexcept -{ - m_array_of_elements = std::move(x.m_array_of_elements); - - return *this; -} - -bool complex_nested_arrays::operator ==( - const complex_nested_arrays& x) const -{ - return (m_array_of_elements == x.m_array_of_elements); -} - -bool complex_nested_arrays::operator !=( - const complex_nested_arrays& x) const -{ - return !(*this == x); -} - -size_t complex_nested_arrays::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return complex_nested_arrays_max_cdr_typesize; -} - -size_t complex_nested_arrays::getCdrSerializedSize( - const complex_nested_arrays& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - for(size_t a = 0; a < data.array_of_elements().size(); ++a) - { - current_alignment += FirstLevelElement::getCdrSerializedSize(data.array_of_elements().at(a), current_alignment); - - } - - - - return current_alignment - initial_alignment; -} - - -void complex_nested_arrays::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_array_of_elements; - - -} - -void complex_nested_arrays::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_array_of_elements; - - -} - - -bool complex_nested_arrays::isKeyDefined() -{ - return false; -} - -void complex_nested_arrays::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member array_of_elements - * @param _array_of_elements New value to be copied in member array_of_elements - */ -void complex_nested_arrays::array_of_elements( - const std::array& _array_of_elements) -{ - m_array_of_elements = _array_of_elements; -} - -/*! - * @brief This function moves the value in member array_of_elements - * @param _array_of_elements New value to be moved in member array_of_elements - */ -void complex_nested_arrays::array_of_elements( - std::array&& _array_of_elements) -{ - m_array_of_elements = std::move(_array_of_elements); -} - -/*! - * @brief This function returns a constant reference to member array_of_elements - * @return Constant reference to member array_of_elements - */ -const std::array& complex_nested_arrays::array_of_elements() const -{ - return m_array_of_elements; -} - -/*! - * @brief This function returns a reference to member array_of_elements - * @return Reference to member array_of_elements - */ -std::array& complex_nested_arrays::array_of_elements() -{ - return m_array_of_elements; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.h deleted file mode 100644 index 66b88bbe..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/complex_nested_arraysv1.h +++ /dev/null @@ -1,760 +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 complex_nested_arrays.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(COMPLEX_NESTED_ARRAYS_SOURCE) -#define COMPLEX_NESTED_ARRAYS_DllAPI __declspec( dllexport ) -#else -#define COMPLEX_NESTED_ARRAYS_DllAPI __declspec( dllimport ) -#endif // COMPLEX_NESTED_ARRAYS_SOURCE -#else -#define COMPLEX_NESTED_ARRAYS_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define COMPLEX_NESTED_ARRAYS_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure ThirdLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class ThirdLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport ThirdLevelElement(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~ThirdLevelElement(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement( - const ThirdLevelElement& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement( - ThirdLevelElement&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement& operator =( - const ThirdLevelElement& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement& operator =( - ThirdLevelElement&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x ThirdLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const ThirdLevelElement& x) const; - - /*! - * @brief Comparison operator. - * @param x ThirdLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const ThirdLevelElement& x) const; - - /*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ - eProsima_user_DllExport void x( - double _x); - - /*! - * @brief This function returns the value of member x - * @return Value of member x - */ - eProsima_user_DllExport double x() const; - - /*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ - eProsima_user_DllExport double& x(); - - - /*! - * @brief This function sets a value in member y - * @param _y New value for member y - */ - eProsima_user_DllExport void y( - double _y); - - /*! - * @brief This function returns the value of member y - * @return Value of member y - */ - eProsima_user_DllExport double y() const; - - /*! - * @brief This function returns a reference to member y - * @return Reference to member y - */ - eProsima_user_DllExport double& y(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const ThirdLevelElement& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - double m_x; - double m_y; - -}; - - - - - -/*! - * @brief This class represents the structure SecondLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class SecondLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SecondLevelElement(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SecondLevelElement(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement( - const SecondLevelElement& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement( - SecondLevelElement&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement& operator =( - const SecondLevelElement& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement& operator =( - SecondLevelElement&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x SecondLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SecondLevelElement& x) const; - - /*! - * @brief Comparison operator. - * @param x SecondLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SecondLevelElement& x) const; - - /*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone); - - /*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone); - - /*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const; - - /*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone(); - - - /*! - * @brief This function copies the value in member a_limited_other_value - * @param _a_limited_other_value New value to be copied in member a_limited_other_value - */ - eProsima_user_DllExport void a_limited_other_value( - const std::vector& _a_limited_other_value); - - /*! - * @brief This function moves the value in member a_limited_other_value - * @param _a_limited_other_value New value to be moved in member a_limited_other_value - */ - eProsima_user_DllExport void a_limited_other_value( - std::vector&& _a_limited_other_value); - - /*! - * @brief This function returns a constant reference to member a_limited_other_value - * @return Constant reference to member a_limited_other_value - */ - eProsima_user_DllExport const std::vector& a_limited_other_value() const; - - /*! - * @brief This function returns a reference to member a_limited_other_value - * @return Reference to member a_limited_other_value - */ - eProsima_user_DllExport std::vector& a_limited_other_value(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const SecondLevelElement& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - ThirdLevelElement m_an_element_alone; - std::vector m_a_limited_other_value; - -}; - - - -/*! - * @brief This class represents the structure FirstLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class FirstLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport FirstLevelElement(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~FirstLevelElement(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement( - const FirstLevelElement& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement( - FirstLevelElement&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement& operator =( - const FirstLevelElement& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement& operator =( - FirstLevelElement&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x FirstLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const FirstLevelElement& x) const; - - /*! - * @brief Comparison operator. - * @param x FirstLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const FirstLevelElement& x) const; - - /*! - * @brief This function copies the value in member useless_name - * @param _useless_name New value to be copied in member useless_name - */ - eProsima_user_DllExport void useless_name( - const std::string& _useless_name); - - /*! - * @brief This function moves the value in member useless_name - * @param _useless_name New value to be moved in member useless_name - */ - eProsima_user_DllExport void useless_name( - std::string&& _useless_name); - - /*! - * @brief This function returns a constant reference to member useless_name - * @return Constant reference to member useless_name - */ - eProsima_user_DllExport const std::string& useless_name() const; - - /*! - * @brief This function returns a reference to member useless_name - * @return Reference to member useless_name - */ - eProsima_user_DllExport std::string& useless_name(); - - - /*! - * @brief This function copies the value in member sub - * @param _sub New value to be copied in member sub - */ - eProsima_user_DllExport void sub( - const std::vector& _sub); - - /*! - * @brief This function moves the value in member sub - * @param _sub New value to be moved in member sub - */ - eProsima_user_DllExport void sub( - std::vector&& _sub); - - /*! - * @brief This function returns a constant reference to member sub - * @return Constant reference to member sub - */ - eProsima_user_DllExport const std::vector& sub() const; - - /*! - * @brief This function returns a reference to member sub - * @return Reference to member sub - */ - eProsima_user_DllExport std::vector& sub(); - - - /*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone); - - /*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone); - - /*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const; - - /*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const FirstLevelElement& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - std::string m_useless_name; - std::vector m_sub; - ThirdLevelElement m_an_element_alone; - -}; - - - -/*! - * @brief This class represents the structure complex_nested_arrays defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class complex_nested_arrays -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport complex_nested_arrays(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~complex_nested_arrays(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays( - const complex_nested_arrays& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays( - complex_nested_arrays&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays& operator =( - const complex_nested_arrays& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays& operator =( - complex_nested_arrays&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x complex_nested_arrays object to compare. - */ - eProsima_user_DllExport bool operator ==( - const complex_nested_arrays& x) const; - - /*! - * @brief Comparison operator. - * @param x complex_nested_arrays object to compare. - */ - eProsima_user_DllExport bool operator !=( - const complex_nested_arrays& x) const; - - /*! - * @brief This function copies the value in member array_of_elements - * @param _array_of_elements New value to be copied in member array_of_elements - */ - eProsima_user_DllExport void array_of_elements( - const std::array& _array_of_elements); - - /*! - * @brief This function moves the value in member array_of_elements - * @param _array_of_elements New value to be moved in member array_of_elements - */ - eProsima_user_DllExport void array_of_elements( - std::array&& _array_of_elements); - - /*! - * @brief This function returns a constant reference to member array_of_elements - * @return Constant reference to member array_of_elements - */ - eProsima_user_DllExport const std::array& array_of_elements() const; - - /*! - * @brief This function returns a reference to member array_of_elements - * @return Reference to member array_of_elements - */ - eProsima_user_DllExport std::array& array_of_elements(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const complex_nested_arrays& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - std::array m_array_of_elements; - -}; - - -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_struct.cxx deleted file mode 100644 index a9f384fe..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_struct.cxx +++ /dev/null @@ -1,162 +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 enum_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "enum_struct.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "enum_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -enum_struct::enum_struct() -{ - // Just to register all known types - registerenum_structTypes(); -} - -enum_struct::~enum_struct() -{ -} - -enum_struct::enum_struct( - const enum_struct& x) -{ - m_index = x.m_index; - m_enum_value = x.m_enum_value; -} - -enum_struct::enum_struct( - enum_struct&& x) noexcept -{ - m_index = x.m_index; - m_enum_value = x.m_enum_value; -} - -enum_struct& enum_struct::operator =( - const enum_struct& x) -{ - - m_index = x.m_index; - m_enum_value = x.m_enum_value; - return *this; -} - -enum_struct& enum_struct::operator =( - enum_struct&& x) noexcept -{ - - m_index = x.m_index; - m_enum_value = x.m_enum_value; - return *this; -} - -bool enum_struct::operator ==( - const enum_struct& x) const -{ - return (m_index == x.m_index && - m_enum_value == x.m_enum_value); -} - -bool enum_struct::operator !=( - const enum_struct& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void enum_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t enum_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& enum_struct::index() -{ - return m_index; -} - - -/*! - * @brief This function sets a value in member enum_value - * @param _enum_value New value for member enum_value - */ -void enum_struct::enum_value( - ColorEnum _enum_value) -{ - m_enum_value = _enum_value; -} - -/*! - * @brief This function returns the value of member enum_value - * @return Value of member enum_value - */ -ColorEnum enum_struct::enum_value() const -{ - return m_enum_value; -} - -/*! - * @brief This function returns a reference to member enum_value - * @return Reference to member enum_value - */ -ColorEnum& enum_struct::enum_value() -{ - return m_enum_value; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "enum_structCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.cxx deleted file mode 100644 index 6ad9350d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.cxx +++ /dev/null @@ -1,496 +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 enum_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "enum_struct.h" -#include "enum_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerenum_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("ColorEnum", GetColorEnumIdentifier(true), - GetColorEnumObject(true)); - factory->add_type_object("ColorEnum", GetColorEnumIdentifier(false), - GetColorEnumObject(false)); - - - factory->add_type_object("enum_struct", Getenum_structIdentifier(true), - Getenum_structObject(true)); - factory->add_type_object("enum_struct", Getenum_structIdentifier(false), - Getenum_structObject(false)); - - }); -} - -const TypeIdentifier* GetColorEnumIdentifier(bool complete) -{ - const TypeIdentifier* c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("ColorEnum", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetColorEnumObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("ColorEnum", complete); -} - -const TypeObject* GetColorEnumObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ColorEnum", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteColorEnumObject(); - } - // else - return GetMinimalColorEnumObject(); -} - -const TypeObject* GetMinimalColorEnumObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ColorEnum", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_ENUM); - - // No flags apply - //type_object->minimal().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->minimal().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->minimal().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->minimal().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->minimal().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - - uint32_t value = 0; - MinimalEnumeratedLiteral mel_RED; - mel_RED.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_RED.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_RED.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_RED.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_RED.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_RED.common().flags().IS_KEY(false); // Doesn't apply - mel_RED.common().flags().IS_DEFAULT(false); - mel_RED.common().value(value++); - MD5 RED_hash("RED"); - for(int i = 0; i < 4; ++i) - { - mel_RED.detail().name_hash()[i] = RED_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_RED); - - MinimalEnumeratedLiteral mel_GREEN; - mel_GREEN.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_GREEN.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_GREEN.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_GREEN.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_GREEN.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_GREEN.common().flags().IS_KEY(false); // Doesn't apply - mel_GREEN.common().flags().IS_DEFAULT(false); - mel_GREEN.common().value(value++); - MD5 GREEN_hash("GREEN"); - for(int i = 0; i < 4; ++i) - { - mel_GREEN.detail().name_hash()[i] = GREEN_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_GREEN); - - MinimalEnumeratedLiteral mel_BLUE; - mel_BLUE.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - mel_BLUE.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - mel_BLUE.common().flags().IS_EXTERNAL(false); // Doesn't apply - mel_BLUE.common().flags().IS_OPTIONAL(false); // Doesn't apply - mel_BLUE.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mel_BLUE.common().flags().IS_KEY(false); // Doesn't apply - mel_BLUE.common().flags().IS_DEFAULT(false); - mel_BLUE.common().value(value++); - MD5 BLUE_hash("BLUE"); - for(int i = 0; i < 4; ++i) - { - mel_BLUE.detail().name_hash()[i] = BLUE_hash.digest[i]; - } - type_object->minimal().enumerated_type().literal_seq().emplace_back(mel_BLUE); - - - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().enumerated_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ColorEnum", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ColorEnum", false); -} - -const TypeObject* GetCompleteColorEnumObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("ColorEnum", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_ENUM); - - // No flags apply - //type_object->complete().enumerated_type().enum_flags().IS_FINAL(false); - //type_object->complete().enumerated_type().enum_flags().IS_APPENDABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_MUTABLE(false); - //type_object->complete().enumerated_type().enum_flags().IS_NESTED(false); - //type_object->complete().enumerated_type().enum_flags().IS_AUTOID_HASH(false); - - type_object->complete().enumerated_type().header().common().bit_bound(32); // TODO fixed by IDL, isn't? - type_object->complete().enumerated_type().header().detail().type_name("ColorEnum"); - - uint32_t value = 0; - CompleteEnumeratedLiteral cel_RED; - cel_RED.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_RED.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_RED.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_RED.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_RED.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_RED.common().flags().IS_KEY(false); // Doesn't apply - cel_RED.common().flags().IS_DEFAULT(false); - cel_RED.common().value(value++); - cel_RED.detail().name("RED"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_RED); - - CompleteEnumeratedLiteral cel_GREEN; - cel_GREEN.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_GREEN.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_GREEN.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_GREEN.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_GREEN.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_GREEN.common().flags().IS_KEY(false); // Doesn't apply - cel_GREEN.common().flags().IS_DEFAULT(false); - cel_GREEN.common().value(value++); - cel_GREEN.detail().name("GREEN"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_GREEN); - - CompleteEnumeratedLiteral cel_BLUE; - cel_BLUE.common().flags().TRY_CONSTRUCT1(false); // Doesn't apply - cel_BLUE.common().flags().TRY_CONSTRUCT2(false); // Doesn't apply - cel_BLUE.common().flags().IS_EXTERNAL(false); // Doesn't apply - cel_BLUE.common().flags().IS_OPTIONAL(false); // Doesn't apply - cel_BLUE.common().flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cel_BLUE.common().flags().IS_KEY(false); // Doesn't apply - cel_BLUE.common().flags().IS_DEFAULT(false); - cel_BLUE.common().value(value++); - cel_BLUE.detail().name("BLUE"); - - type_object->complete().enumerated_type().literal_seq().emplace_back(cel_BLUE); - - - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().enumerated_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("ColorEnum", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("ColorEnum", true); -} - - - -const TypeIdentifier* Getenum_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("enum_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getenum_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("enum_struct", complete); -} - -const TypeObject* Getenum_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("enum_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteenum_structObject(); - } - //else - return GetMinimalenum_structObject(); -} - -const TypeObject* GetMinimalenum_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("enum_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_enum_value; - mst_enum_value.common().member_id(memberId++); - mst_enum_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_enum_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_enum_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_enum_value.common().member_flags().IS_OPTIONAL(false); - mst_enum_value.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_enum_value.common().member_flags().IS_KEY(false); - mst_enum_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_enum_value.common().member_type_id(*GetColorEnumIdentifier(false)); - - MD5 enum_value_hash("enum_value"); - for(int i = 0; i < 4; ++i) - { - mst_enum_value.detail().name_hash()[i] = enum_value_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_enum_value); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("enum_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("enum_struct", false); -} - -const TypeObject* GetCompleteenum_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("enum_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_enum_value; - cst_enum_value.common().member_id(memberId++); - cst_enum_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_enum_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_enum_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_enum_value.common().member_flags().IS_OPTIONAL(false); - cst_enum_value.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_enum_value.common().member_flags().IS_KEY(false); - cst_enum_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_enum_value.common().member_type_id(*GetColorEnumIdentifier(true)); - - cst_enum_value.detail().name("enum_value"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_enum_value); - - - // Header - type_object->complete().struct_type().header().detail().type_name("enum_struct"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("enum_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("enum_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.h deleted file mode 100644 index 795c5d96..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structTypeObject.h +++ /dev/null @@ -1,70 +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 enum_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(enum_struct_SOURCE) -#define enum_struct_DllAPI __declspec( dllexport ) -#else -#define enum_struct_DllAPI __declspec( dllimport ) -#endif // enum_struct_SOURCE -#else -#define enum_struct_DllAPI -#endif -#else -#define enum_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerenum_structTypes(); - -eProsima_user_DllExport const TypeIdentifier* GetColorEnumIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetColorEnumObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalColorEnumObject(); -eProsima_user_DllExport const TypeObject* GetCompleteColorEnumObject(); - - - -eProsima_user_DllExport const TypeIdentifier* Getenum_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getenum_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalenum_structObject(); -eProsima_user_DllExport const TypeObject* GetCompleteenum_structObject(); - - -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.cxx deleted file mode 100644 index 835121d4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.cxx +++ /dev/null @@ -1,285 +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 enum_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "enum_struct.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "enum_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define enum_struct_max_cdr_typesize 12ULL; - - - - - -enum_struct::enum_struct() -{ - // unsigned long m_index - m_index = 0; - // ColorEnum m_enum_value - m_enum_value = ::RED; - - // Just to register all known types - registerenum_structTypes(); -} - -enum_struct::~enum_struct() -{ -} - -enum_struct::enum_struct( - const enum_struct& x) -{ - m_index = x.m_index; - - - m_enum_value = x.m_enum_value; - -} - -enum_struct::enum_struct( - enum_struct&& x) noexcept -{ - m_index = x.m_index; - - - m_enum_value = x.m_enum_value; - -} - -enum_struct& enum_struct::operator =( - const enum_struct& x) -{ - m_index = x.m_index; - - - m_enum_value = x.m_enum_value; - - return *this; -} - -enum_struct& enum_struct::operator =( - enum_struct&& x) noexcept -{ - m_index = x.m_index; - - - m_enum_value = x.m_enum_value; - - return *this; -} - -bool enum_struct::operator ==( - const enum_struct& x) const -{ - return (m_index == x.m_index && - m_enum_value == x.m_enum_value); -} - -bool enum_struct::operator !=( - const enum_struct& x) const -{ - return !(*this == x); -} - -size_t enum_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return enum_struct_max_cdr_typesize; -} - -size_t enum_struct::getCdrSerializedSize( - const enum_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void enum_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_index; - - scdr << (uint32_t)m_enum_value; - -} - -void enum_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_index; - - - - { - uint32_t enum_value = 0; - dcdr >> enum_value; - m_enum_value = (ColorEnum)enum_value; - } - - -} - - -bool enum_struct::isKeyDefined() -{ - return false; -} - -void enum_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void enum_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t enum_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& enum_struct::index() -{ - return m_index; -} - - -/*! - * @brief This function sets a value in member enum_value - * @param _enum_value New value for member enum_value - */ -void enum_struct::enum_value( - ColorEnum _enum_value) -{ - m_enum_value = _enum_value; -} - -/*! - * @brief This function returns the value of member enum_value - * @return Value of member enum_value - */ -ColorEnum enum_struct::enum_value() const -{ - return m_enum_value; -} - -/*! - * @brief This function returns a reference to member enum_value - * @return Reference to member enum_value - */ -ColorEnum& enum_struct::enum_value() -{ - return m_enum_value; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.h deleted file mode 100644 index 646f7876..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/enum_structv1.h +++ /dev/null @@ -1,246 +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 enum_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_H_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(ENUM_STRUCT_SOURCE) -#define ENUM_STRUCT_DllAPI __declspec( dllexport ) -#else -#define ENUM_STRUCT_DllAPI __declspec( dllimport ) -#endif // ENUM_STRUCT_SOURCE -#else -#define ENUM_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define ENUM_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - -/*! - * @brief This class represents the enumeration ColorEnum defined by the user in the IDL file. - * @ingroup enum_struct - */ -enum ColorEnum : uint32_t -{ - RED, - GREEN, - BLUE -}; - - -/*! - * @brief This class represents the structure enum_struct defined by the user in the IDL file. - * @ingroup enum_struct - */ -class enum_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport enum_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~enum_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct( - const enum_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct( - enum_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct& operator =( - const enum_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct& operator =( - enum_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x enum_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const enum_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x enum_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const enum_struct& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - - /*! - * @brief This function sets a value in member enum_value - * @param _enum_value New value for member enum_value - */ - eProsima_user_DllExport void enum_value( - ColorEnum _enum_value); - - /*! - * @brief This function returns the value of member enum_value - * @return Value of member enum_value - */ - eProsima_user_DllExport ColorEnum enum_value() const; - - /*! - * @brief This function returns a reference to member enum_value - * @return Reference to member enum_value - */ - eProsima_user_DllExport ColorEnum& enum_value(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const enum_struct& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - uint32_t m_index; - ColorEnum m_enum_value; - -}; - - -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequence.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequence.cxx deleted file mode 100644 index d4a503d2..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequence.cxx +++ /dev/null @@ -1,140 +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 float_bounded_sequence.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "float_bounded_sequence.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "float_bounded_sequenceTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - - - -float_bounded_sequence::float_bounded_sequence() -{ - // Just to register all known types - registerfloat_bounded_sequenceTypes(); -} - -float_bounded_sequence::~float_bounded_sequence() -{ -} - -float_bounded_sequence::float_bounded_sequence( - const float_bounded_sequence& x) -{ - m_numbers = x.m_numbers; -} - -float_bounded_sequence::float_bounded_sequence( - float_bounded_sequence&& x) noexcept -{ - m_numbers = std::move(x.m_numbers); -} - -float_bounded_sequence& float_bounded_sequence::operator =( - const float_bounded_sequence& x) -{ - - m_numbers = x.m_numbers; - return *this; -} - -float_bounded_sequence& float_bounded_sequence::operator =( - float_bounded_sequence&& x) noexcept -{ - - m_numbers = std::move(x.m_numbers); - return *this; -} - -bool float_bounded_sequence::operator ==( - const float_bounded_sequence& x) const -{ - return (m_numbers == x.m_numbers); -} - -bool float_bounded_sequence::operator !=( - const float_bounded_sequence& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member numbers - * @param _numbers New value to be copied in member numbers - */ -void float_bounded_sequence::numbers( - const std::vector& _numbers) -{ - m_numbers = _numbers; -} - -/*! - * @brief This function moves the value in member numbers - * @param _numbers New value to be moved in member numbers - */ -void float_bounded_sequence::numbers( - std::vector&& _numbers) -{ - m_numbers = std::move(_numbers); -} - -/*! - * @brief This function returns a constant reference to member numbers - * @return Constant reference to member numbers - */ -const std::vector& float_bounded_sequence::numbers() const -{ - return m_numbers; -} - -/*! - * @brief This function returns a reference to member numbers - * @return Reference to member numbers - */ -std::vector& float_bounded_sequence::numbers() -{ - return m_numbers; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "float_bounded_sequenceCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.cxx deleted file mode 100644 index ad7d52d9..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.cxx +++ /dev/null @@ -1,230 +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 float_bounded_sequenceTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "float_bounded_sequence.h" -#include "float_bounded_sequenceTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerfloat_bounded_sequenceTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("float_bounded_sequence", Getfloat_bounded_sequenceIdentifier(true), - Getfloat_bounded_sequenceObject(true)); - factory->add_type_object("float_bounded_sequence", Getfloat_bounded_sequenceIdentifier(false), - Getfloat_bounded_sequenceObject(false)); - - }); -} - - - - - -const TypeIdentifier* Getfloat_bounded_sequenceIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("float_bounded_sequence", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getfloat_bounded_sequenceObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("float_bounded_sequence", complete); -} - -const TypeObject* Getfloat_bounded_sequenceObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletefloat_bounded_sequenceObject(); - } - //else - return GetMinimalfloat_bounded_sequenceObject(); -} - -const TypeObject* GetMinimalfloat_bounded_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_numbers; - mst_numbers.common().member_id(memberId++); - mst_numbers.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_numbers.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_numbers.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_numbers.common().member_flags().IS_OPTIONAL(false); - mst_numbers.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_numbers.common().member_flags().IS_KEY(false); - mst_numbers.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_numbers.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("float", 13, false)); - - MD5 numbers_hash("numbers"); - for(int i = 0; i < 4; ++i) - { - mst_numbers.detail().name_hash()[i] = numbers_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_numbers); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("float_bounded_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", false); -} - -const TypeObject* GetCompletefloat_bounded_sequenceObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_numbers; - cst_numbers.common().member_id(memberId++); - cst_numbers.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_numbers.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_numbers.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_numbers.common().member_flags().IS_OPTIONAL(false); - cst_numbers.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_numbers.common().member_flags().IS_KEY(false); - cst_numbers.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_numbers.common().member_type_id(*TypeObjectFactory::get_instance()->get_sequence_identifier("float", 13, true)); - - cst_numbers.detail().name("numbers"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_numbers); - - - // Header - type_object->complete().struct_type().header().detail().type_name("float_bounded_sequence"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("float_bounded_sequence", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("float_bounded_sequence", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.h deleted file mode 100644 index ebd7c318..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequenceTypeObject.h +++ /dev/null @@ -1,67 +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 float_bounded_sequenceTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(float_bounded_sequence_SOURCE) -#define float_bounded_sequence_DllAPI __declspec( dllexport ) -#else -#define float_bounded_sequence_DllAPI __declspec( dllimport ) -#endif // float_bounded_sequence_SOURCE -#else -#define float_bounded_sequence_DllAPI -#endif -#else -#define float_bounded_sequence_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerfloat_bounded_sequenceTypes(); - - - - - -eProsima_user_DllExport const TypeIdentifier* Getfloat_bounded_sequenceIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getfloat_bounded_sequenceObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalfloat_bounded_sequenceObject(); -eProsima_user_DllExport const TypeObject* GetCompletefloat_bounded_sequenceObject(); - - -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.cxx deleted file mode 100644 index aacdac49..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.cxx +++ /dev/null @@ -1,247 +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 float_bounded_sequence.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "float_bounded_sequence.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "float_bounded_sequenceTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define float_bounded_sequence_max_cdr_typesize 60ULL; - - - - - - -float_bounded_sequence::float_bounded_sequence() -{ - // sequence m_numbers - - - // Just to register all known types - registerfloat_bounded_sequenceTypes(); -} - -float_bounded_sequence::~float_bounded_sequence() -{ -} - -float_bounded_sequence::float_bounded_sequence( - const float_bounded_sequence& x) -{ - m_numbers = x.m_numbers; - -} - -float_bounded_sequence::float_bounded_sequence( - float_bounded_sequence&& x) noexcept -{ - m_numbers = std::move(x.m_numbers); - -} - -float_bounded_sequence& float_bounded_sequence::operator =( - const float_bounded_sequence& x) -{ - m_numbers = x.m_numbers; - - return *this; -} - -float_bounded_sequence& float_bounded_sequence::operator =( - float_bounded_sequence&& x) noexcept -{ - m_numbers = std::move(x.m_numbers); - - return *this; -} - -bool float_bounded_sequence::operator ==( - const float_bounded_sequence& x) const -{ - return (m_numbers == x.m_numbers); -} - -bool float_bounded_sequence::operator !=( - const float_bounded_sequence& x) const -{ - return !(*this == x); -} - -size_t float_bounded_sequence::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return float_bounded_sequence_max_cdr_typesize; -} - -size_t float_bounded_sequence::getCdrSerializedSize( - const float_bounded_sequence& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - if (data.numbers().size() > 0) - { - current_alignment += (data.numbers().size() * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - } - - - - - return current_alignment - initial_alignment; -} - - -void float_bounded_sequence::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_numbers; - - -} - -void float_bounded_sequence::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_numbers; - - -} - - -bool float_bounded_sequence::isKeyDefined() -{ - return false; -} - -void float_bounded_sequence::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member numbers - * @param _numbers New value to be copied in member numbers - */ -void float_bounded_sequence::numbers( - const std::vector& _numbers) -{ - m_numbers = _numbers; -} - -/*! - * @brief This function moves the value in member numbers - * @param _numbers New value to be moved in member numbers - */ -void float_bounded_sequence::numbers( - std::vector&& _numbers) -{ - m_numbers = std::move(_numbers); -} - -/*! - * @brief This function returns a constant reference to member numbers - * @return Constant reference to member numbers - */ -const std::vector& float_bounded_sequence::numbers() const -{ - return m_numbers; -} - -/*! - * @brief This function returns a reference to member numbers - * @return Reference to member numbers - */ -std::vector& float_bounded_sequence::numbers() -{ - return m_numbers; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.h deleted file mode 100644 index b5abe95c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/float_bounded_sequencev1.h +++ /dev/null @@ -1,224 +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 float_bounded_sequence.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(FLOAT_BOUNDED_SEQUENCE_SOURCE) -#define FLOAT_BOUNDED_SEQUENCE_DllAPI __declspec( dllexport ) -#else -#define FLOAT_BOUNDED_SEQUENCE_DllAPI __declspec( dllimport ) -#endif // FLOAT_BOUNDED_SEQUENCE_SOURCE -#else -#define FLOAT_BOUNDED_SEQUENCE_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define FLOAT_BOUNDED_SEQUENCE_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - - - -/*! - * @brief This class represents the structure float_bounded_sequence defined by the user in the IDL file. - * @ingroup float_bounded_sequence - */ -class float_bounded_sequence -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport float_bounded_sequence(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~float_bounded_sequence(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence( - const float_bounded_sequence& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence( - float_bounded_sequence&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence& operator =( - const float_bounded_sequence& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence& operator =( - float_bounded_sequence&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x float_bounded_sequence object to compare. - */ - eProsima_user_DllExport bool operator ==( - const float_bounded_sequence& x) const; - - /*! - * @brief Comparison operator. - * @param x float_bounded_sequence object to compare. - */ - eProsima_user_DllExport bool operator !=( - const float_bounded_sequence& x) const; - - /*! - * @brief This function copies the value in member numbers - * @param _numbers New value to be copied in member numbers - */ - eProsima_user_DllExport void numbers( - const std::vector& _numbers); - - /*! - * @brief This function moves the value in member numbers - * @param _numbers New value to be moved in member numbers - */ - eProsima_user_DllExport void numbers( - std::vector&& _numbers); - - /*! - * @brief This function returns a constant reference to member numbers - * @return Constant reference to member numbers - */ - eProsima_user_DllExport const std::vector& numbers() const; - - /*! - * @brief This function returns a reference to member numbers - * @return Reference to member numbers - */ - eProsima_user_DllExport std::vector& numbers(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const float_bounded_sequence& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - std::vector m_numbers; - -}; - - -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_world.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_world.cxx deleted file mode 100644 index 2ee1dd79..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_world.cxx +++ /dev/null @@ -1,172 +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 hello_world.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "hello_world.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "hello_worldTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -hello_world::hello_world() -{ - // Just to register all known types - registerhello_worldTypes(); -} - -hello_world::~hello_world() -{ -} - -hello_world::hello_world( - const hello_world& x) -{ - m_index = x.m_index; - m_message = x.m_message; -} - -hello_world::hello_world( - hello_world&& x) noexcept -{ - m_index = x.m_index; - m_message = std::move(x.m_message); -} - -hello_world& hello_world::operator =( - const hello_world& x) -{ - - m_index = x.m_index; - m_message = x.m_message; - return *this; -} - -hello_world& hello_world::operator =( - hello_world&& x) noexcept -{ - - m_index = x.m_index; - m_message = std::move(x.m_message); - return *this; -} - -bool hello_world::operator ==( - const hello_world& x) const -{ - return (m_index == x.m_index && - m_message == x.m_message); -} - -bool hello_world::operator !=( - const hello_world& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void hello_world::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t hello_world::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& hello_world::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void hello_world::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void hello_world::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& hello_world::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& hello_world::message() -{ - return m_message; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "hello_worldCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.cxx deleted file mode 100644 index d6ece315..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.cxx +++ /dev/null @@ -1,263 +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 hello_worldTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "hello_world.h" -#include "hello_worldTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerhello_worldTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("hello_world", Gethello_worldIdentifier(true), - Gethello_worldObject(true)); - factory->add_type_object("hello_world", Gethello_worldIdentifier(false), - Gethello_worldObject(false)); - - }); -} - - - -const TypeIdentifier* Gethello_worldIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("hello_world", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Gethello_worldObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("hello_world", complete); -} - -const TypeObject* Gethello_worldObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("hello_world", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletehello_worldObject(); - } - //else - return GetMinimalhello_worldObject(); -} - -const TypeObject* GetMinimalhello_worldObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("hello_world", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_message; - mst_message.common().member_id(memberId++); - mst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_message.common().member_flags().IS_OPTIONAL(false); - mst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_message.common().member_flags().IS_KEY(false); - mst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - MD5 message_hash("message"); - for(int i = 0; i < 4; ++i) - { - mst_message.detail().name_hash()[i] = message_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_message); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("hello_world", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("hello_world", false); -} - -const TypeObject* GetCompletehello_worldObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("hello_world", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_message; - cst_message.common().member_id(memberId++); - cst_message.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_message.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_message.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_message.common().member_flags().IS_OPTIONAL(false); - cst_message.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_message.common().member_flags().IS_KEY(false); - cst_message.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_message.common().member_type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - cst_message.detail().name("message"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_message); - - - // Header - type_object->complete().struct_type().header().detail().type_name("hello_world"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("hello_world", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("hello_world", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.h deleted file mode 100644 index 6e3ff21a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldTypeObject.h +++ /dev/null @@ -1,65 +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 hello_worldTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(hello_world_SOURCE) -#define hello_world_DllAPI __declspec( dllexport ) -#else -#define hello_world_DllAPI __declspec( dllimport ) -#endif // hello_world_SOURCE -#else -#define hello_world_DllAPI -#endif -#else -#define hello_world_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerhello_worldTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* Gethello_worldIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Gethello_worldObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalhello_worldObject(); -eProsima_user_DllExport const TypeObject* GetCompletehello_worldObject(); - - -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.cxx deleted file mode 100644 index 245df98d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.cxx +++ /dev/null @@ -1,290 +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 hello_world.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "hello_world.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "hello_worldTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define hello_world_max_cdr_typesize 268ULL; - - - - -hello_world::hello_world() -{ - // unsigned long m_index - m_index = 0; - // /type_d() m_message - - - // Just to register all known types - registerhello_worldTypes(); -} - -hello_world::~hello_world() -{ -} - -hello_world::hello_world( - const hello_world& x) -{ - m_index = x.m_index; - - - m_message = x.m_message; - -} - -hello_world::hello_world( - hello_world&& x) noexcept -{ - m_index = x.m_index; - - - m_message = std::move(x.m_message); - -} - -hello_world& hello_world::operator =( - const hello_world& x) -{ - m_index = x.m_index; - - - m_message = x.m_message; - - return *this; -} - -hello_world& hello_world::operator =( - hello_world&& x) noexcept -{ - m_index = x.m_index; - - - m_message = std::move(x.m_message); - - return *this; -} - -bool hello_world::operator ==( - const hello_world& x) const -{ - return (m_index == x.m_index && - m_message == x.m_message); -} - -bool hello_world::operator !=( - const hello_world& x) const -{ - return !(*this == x); -} - -size_t hello_world::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return hello_world_max_cdr_typesize; -} - -size_t hello_world::getCdrSerializedSize( - const hello_world& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1; - - - return current_alignment - initial_alignment; -} - - -void hello_world::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_index; - - scdr << m_message.c_str(); - -} - -void hello_world::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_index; - - - - dcdr >> m_message; - - -} - - -bool hello_world::isKeyDefined() -{ - return false; -} - -void hello_world::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void hello_world::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t hello_world::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& hello_world::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void hello_world::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void hello_world::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& hello_world::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& hello_world::message() -{ - return m_message; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.h deleted file mode 100644 index 66250281..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/hello_worldv1.h +++ /dev/null @@ -1,243 +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 hello_world.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_H_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(HELLO_WORLD_SOURCE) -#define HELLO_WORLD_DllAPI __declspec( dllexport ) -#else -#define HELLO_WORLD_DllAPI __declspec( dllimport ) -#endif // HELLO_WORLD_SOURCE -#else -#define HELLO_WORLD_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define HELLO_WORLD_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure hello_world defined by the user in the IDL file. - * @ingroup hello_world - */ -class hello_world -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport hello_world(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~hello_world(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world( - const hello_world& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world( - hello_world&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world& operator =( - const hello_world& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world& operator =( - hello_world&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x hello_world object to compare. - */ - eProsima_user_DllExport bool operator ==( - const hello_world& x) const; - - /*! - * @brief Comparison operator. - * @param x hello_world object to compare. - */ - eProsima_user_DllExport bool operator !=( - const hello_world& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::string& _message); - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::string&& _message); - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::string& message() const; - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::string& message(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const hello_world& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - uint32_t m_index; - std::string m_message; - -}; - - -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_struct.cxx deleted file mode 100644 index a76192c3..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_struct.cxx +++ /dev/null @@ -1,140 +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 map_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "map_struct.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "map_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - - - -map_struct::map_struct() -{ - // Just to register all known types - registermap_structTypes(); -} - -map_struct::~map_struct() -{ -} - -map_struct::map_struct( - const map_struct& x) -{ - m_my_map = x.m_my_map; -} - -map_struct::map_struct( - map_struct&& x) noexcept -{ - m_my_map = std::move(x.m_my_map); -} - -map_struct& map_struct::operator =( - const map_struct& x) -{ - - m_my_map = x.m_my_map; - return *this; -} - -map_struct& map_struct::operator =( - map_struct&& x) noexcept -{ - - m_my_map = std::move(x.m_my_map); - return *this; -} - -bool map_struct::operator ==( - const map_struct& x) const -{ - return (m_my_map == x.m_my_map); -} - -bool map_struct::operator !=( - const map_struct& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member my_map - * @param _my_map New value to be copied in member my_map - */ -void map_struct::my_map( - const std::map& _my_map) -{ - m_my_map = _my_map; -} - -/*! - * @brief This function moves the value in member my_map - * @param _my_map New value to be moved in member my_map - */ -void map_struct::my_map( - std::map&& _my_map) -{ - m_my_map = std::move(_my_map); -} - -/*! - * @brief This function returns a constant reference to member my_map - * @return Constant reference to member my_map - */ -const std::map& map_struct::my_map() const -{ - return m_my_map; -} - -/*! - * @brief This function returns a reference to member my_map - * @return Reference to member my_map - */ -std::map& map_struct::my_map() -{ - return m_my_map; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "map_structCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.cxx deleted file mode 100644 index 8c1761f7..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.cxx +++ /dev/null @@ -1,230 +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 map_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "map_struct.h" -#include "map_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registermap_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("map_struct", Getmap_structIdentifier(true), - Getmap_structObject(true)); - factory->add_type_object("map_struct", Getmap_structIdentifier(false), - Getmap_structObject(false)); - - }); -} - - - - - -const TypeIdentifier* Getmap_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("map_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getmap_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("map_struct", complete); -} - -const TypeObject* Getmap_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("map_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletemap_structObject(); - } - //else - return GetMinimalmap_structObject(); -} - -const TypeObject* GetMinimalmap_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("map_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_my_map; - mst_my_map.common().member_id(memberId++); - mst_my_map.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_my_map.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_my_map.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_my_map.common().member_flags().IS_OPTIONAL(false); - mst_my_map.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_my_map.common().member_flags().IS_KEY(false); - mst_my_map.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_my_map.common().member_type_id(*TypeObjectFactory::get_instance()->get_map_identifier(TypeNamesGenerator::get_string_type_name(255, false), "bool", 100, false)); - - MD5 my_map_hash("my_map"); - for(int i = 0; i < 4; ++i) - { - mst_my_map.detail().name_hash()[i] = my_map_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_my_map); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("map_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("map_struct", false); -} - -const TypeObject* GetCompletemap_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("map_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_my_map; - cst_my_map.common().member_id(memberId++); - cst_my_map.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_my_map.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_my_map.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_my_map.common().member_flags().IS_OPTIONAL(false); - cst_my_map.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_my_map.common().member_flags().IS_KEY(false); - cst_my_map.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_my_map.common().member_type_id(*TypeObjectFactory::get_instance()->get_map_identifier(TypeNamesGenerator::get_string_type_name(255, false), "bool", 100, true)); - - cst_my_map.detail().name("my_map"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_my_map); - - - // Header - type_object->complete().struct_type().header().detail().type_name("map_struct"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("map_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("map_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.h deleted file mode 100644 index b36c5102..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structTypeObject.h +++ /dev/null @@ -1,67 +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 map_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(map_struct_SOURCE) -#define map_struct_DllAPI __declspec( dllexport ) -#else -#define map_struct_DllAPI __declspec( dllimport ) -#endif // map_struct_SOURCE -#else -#define map_struct_DllAPI -#endif -#else -#define map_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registermap_structTypes(); - - - - - -eProsima_user_DllExport const TypeIdentifier* Getmap_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getmap_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalmap_structObject(); -eProsima_user_DllExport const TypeObject* GetCompletemap_structObject(); - - -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.cxx deleted file mode 100644 index cc73fa45..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.cxx +++ /dev/null @@ -1,268 +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 map_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "map_struct.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "map_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define map_struct_max_cdr_typesize 26405ULL; - - - - - - -map_struct::map_struct() -{ - // map m_my_map - - - // Just to register all known types - registermap_structTypes(); -} - -map_struct::~map_struct() -{ -} - -map_struct::map_struct( - const map_struct& x) -{ - m_my_map = x.m_my_map; - -} - -map_struct::map_struct( - map_struct&& x) noexcept -{ - m_my_map = std::move(x.m_my_map); - -} - -map_struct& map_struct::operator =( - const map_struct& x) -{ - m_my_map = x.m_my_map; - - return *this; -} - -map_struct& map_struct::operator =( - map_struct&& x) noexcept -{ - m_my_map = std::move(x.m_my_map); - - return *this; -} - -bool map_struct::operator ==( - const map_struct& x) const -{ - return (m_my_map == x.m_my_map); -} - -bool map_struct::operator !=( - const map_struct& x) const -{ - return !(*this == x); -} - -size_t map_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return map_struct_max_cdr_typesize; -} - -size_t map_struct::getCdrSerializedSize( - const map_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - for(auto a : data.my_map()) - { - (void)a; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + a.first.size() + 1; - - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - } - - - return current_alignment - initial_alignment; -} - - -void map_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << static_cast(m_my_map.size()); - for (const auto& pair : m_my_map) - { - scdr << pair.first.c_str(); - scdr << pair.second; - } - -} - -void map_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - uint32_t seq_length = 0; - dcdr >> seq_length; - m_my_map.clear(); - for (uint32_t i = 0; i < seq_length; ++i) - { - std::string key; - dcdr >> key; - - - bool value; - dcdr >> value; - m_my_map[key.c_str()] = value; - - } - - -} - - -bool map_struct::isKeyDefined() -{ - return false; -} - -void map_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member my_map - * @param _my_map New value to be copied in member my_map - */ -void map_struct::my_map( - const std::map& _my_map) -{ - m_my_map = _my_map; -} - -/*! - * @brief This function moves the value in member my_map - * @param _my_map New value to be moved in member my_map - */ -void map_struct::my_map( - std::map&& _my_map) -{ - m_my_map = std::move(_my_map); -} - -/*! - * @brief This function returns a constant reference to member my_map - * @return Constant reference to member my_map - */ -const std::map& map_struct::my_map() const -{ - return m_my_map; -} - -/*! - * @brief This function returns a reference to member my_map - * @return Reference to member my_map - */ -std::map& map_struct::my_map() -{ - return m_my_map; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.h deleted file mode 100644 index 4ed18689..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/map_structv1.h +++ /dev/null @@ -1,224 +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 map_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_H_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MAP_STRUCT_SOURCE) -#define MAP_STRUCT_DllAPI __declspec( dllexport ) -#else -#define MAP_STRUCT_DllAPI __declspec( dllimport ) -#endif // MAP_STRUCT_SOURCE -#else -#define MAP_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MAP_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - - - -/*! - * @brief This class represents the structure map_struct defined by the user in the IDL file. - * @ingroup map_struct - */ -class map_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport map_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~map_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct( - const map_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct( - map_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct& operator =( - const map_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct& operator =( - map_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x map_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const map_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x map_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const map_struct& x) const; - - /*! - * @brief This function copies the value in member my_map - * @param _my_map New value to be copied in member my_map - */ - eProsima_user_DllExport void my_map( - const std::map& _my_map); - - /*! - * @brief This function moves the value in member my_map - * @param _my_map New value to be moved in member my_map - */ - eProsima_user_DllExport void my_map( - std::map&& _my_map); - - /*! - * @brief This function returns a constant reference to member my_map - * @return Constant reference to member my_map - */ - eProsima_user_DllExport const std::map& my_map() const; - - /*! - * @brief This function returns a reference to member my_map - * @return Reference to member my_map - */ - eProsima_user_DllExport std::map& my_map(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const map_struct& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - std::map m_my_map; - -}; - - -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_array.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_array.cxx deleted file mode 100644 index 06dba498..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_array.cxx +++ /dev/null @@ -1,138 +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 numeric_array.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "numeric_array.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "numeric_arrayTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -numeric_array::numeric_array() -{ - // Just to register all known types - registernumeric_arrayTypes(); -} - -numeric_array::~numeric_array() -{ -} - -numeric_array::numeric_array( - const numeric_array& x) -{ - m_points = x.m_points; -} - -numeric_array::numeric_array( - numeric_array&& x) noexcept -{ - m_points = std::move(x.m_points); -} - -numeric_array& numeric_array::operator =( - const numeric_array& x) -{ - - m_points = x.m_points; - return *this; -} - -numeric_array& numeric_array::operator =( - numeric_array&& x) noexcept -{ - - m_points = std::move(x.m_points); - return *this; -} - -bool numeric_array::operator ==( - const numeric_array& x) const -{ - return (m_points == x.m_points); -} - -bool numeric_array::operator !=( - const numeric_array& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member points - * @param _points New value to be copied in member points - */ -void numeric_array::points( - const std::array& _points) -{ - m_points = _points; -} - -/*! - * @brief This function moves the value in member points - * @param _points New value to be moved in member points - */ -void numeric_array::points( - std::array&& _points) -{ - m_points = std::move(_points); -} - -/*! - * @brief This function returns a constant reference to member points - * @return Constant reference to member points - */ -const std::array& numeric_array::points() const -{ - return m_points; -} - -/*! - * @brief This function returns a reference to member points - * @return Reference to member points - */ -std::array& numeric_array::points() -{ - return m_points; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "numeric_arrayCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.cxx deleted file mode 100644 index ee725383..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.cxx +++ /dev/null @@ -1,228 +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 numeric_arrayTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "numeric_array.h" -#include "numeric_arrayTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registernumeric_arrayTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("numeric_array", Getnumeric_arrayIdentifier(true), - Getnumeric_arrayObject(true)); - factory->add_type_object("numeric_array", Getnumeric_arrayIdentifier(false), - Getnumeric_arrayObject(false)); - - }); -} - - - -const TypeIdentifier* Getnumeric_arrayIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("numeric_array", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getnumeric_arrayObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("numeric_array", complete); -} - -const TypeObject* Getnumeric_arrayObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("numeric_array", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompletenumeric_arrayObject(); - } - //else - return GetMinimalnumeric_arrayObject(); -} - -const TypeObject* GetMinimalnumeric_arrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("numeric_array", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_points; - mst_points.common().member_id(memberId++); - mst_points.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_points.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_points.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_points.common().member_flags().IS_OPTIONAL(false); - mst_points.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_points.common().member_flags().IS_KEY(false); - mst_points.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_points.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("int32_t", {3}, false)); - - MD5 points_hash("points"); - for(int i = 0; i < 4; ++i) - { - mst_points.detail().name_hash()[i] = points_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_points); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("numeric_array", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("numeric_array", false); -} - -const TypeObject* GetCompletenumeric_arrayObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("numeric_array", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_points; - cst_points.common().member_id(memberId++); - cst_points.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_points.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_points.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_points.common().member_flags().IS_OPTIONAL(false); - cst_points.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_points.common().member_flags().IS_KEY(false); - cst_points.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_points.common().member_type_id(*TypeObjectFactory::get_instance()->get_array_identifier("int32_t", {3}, true)); - - cst_points.detail().name("points"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_points); - - - // Header - type_object->complete().struct_type().header().detail().type_name("numeric_array"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("numeric_array", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("numeric_array", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.h deleted file mode 100644 index 55a4b992..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayTypeObject.h +++ /dev/null @@ -1,65 +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 numeric_arrayTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(numeric_array_SOURCE) -#define numeric_array_DllAPI __declspec( dllexport ) -#else -#define numeric_array_DllAPI __declspec( dllimport ) -#endif // numeric_array_SOURCE -#else -#define numeric_array_DllAPI -#endif -#else -#define numeric_array_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registernumeric_arrayTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* Getnumeric_arrayIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getnumeric_arrayObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalnumeric_arrayObject(); -eProsima_user_DllExport const TypeObject* GetCompletenumeric_arrayObject(); - - -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.cxx deleted file mode 100644 index 28ba3802..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.cxx +++ /dev/null @@ -1,239 +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 numeric_array.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "numeric_array.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "numeric_arrayTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define numeric_array_max_cdr_typesize 16ULL; - - - - -numeric_array::numeric_array() -{ - // long m_points - memset(&m_points, 0, ((3)) * 4); - - // Just to register all known types - registernumeric_arrayTypes(); -} - -numeric_array::~numeric_array() -{ -} - -numeric_array::numeric_array( - const numeric_array& x) -{ - m_points = x.m_points; - -} - -numeric_array::numeric_array( - numeric_array&& x) noexcept -{ - m_points = std::move(x.m_points); - -} - -numeric_array& numeric_array::operator =( - const numeric_array& x) -{ - m_points = x.m_points; - - return *this; -} - -numeric_array& numeric_array::operator =( - numeric_array&& x) noexcept -{ - m_points = std::move(x.m_points); - - return *this; -} - -bool numeric_array::operator ==( - const numeric_array& x) const -{ - return (m_points == x.m_points); -} - -bool numeric_array::operator !=( - const numeric_array& x) const -{ - return !(*this == x); -} - -size_t numeric_array::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return numeric_array_max_cdr_typesize; -} - -size_t numeric_array::getCdrSerializedSize( - const numeric_array& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += (((3)) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - return current_alignment - initial_alignment; -} - - -void numeric_array::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_points; - - -} - -void numeric_array::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_points; - - -} - - -bool numeric_array::isKeyDefined() -{ - return false; -} - -void numeric_array::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member points - * @param _points New value to be copied in member points - */ -void numeric_array::points( - const std::array& _points) -{ - m_points = _points; -} - -/*! - * @brief This function moves the value in member points - * @param _points New value to be moved in member points - */ -void numeric_array::points( - std::array&& _points) -{ - m_points = std::move(_points); -} - -/*! - * @brief This function returns a constant reference to member points - * @return Constant reference to member points - */ -const std::array& numeric_array::points() const -{ - return m_points; -} - -/*! - * @brief This function returns a reference to member points - * @return Reference to member points - */ -std::array& numeric_array::points() -{ - return m_points; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.h deleted file mode 100644 index 794e52ee..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/numeric_arrayv1.h +++ /dev/null @@ -1,222 +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 numeric_array.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(NUMERIC_ARRAY_SOURCE) -#define NUMERIC_ARRAY_DllAPI __declspec( dllexport ) -#else -#define NUMERIC_ARRAY_DllAPI __declspec( dllimport ) -#endif // NUMERIC_ARRAY_SOURCE -#else -#define NUMERIC_ARRAY_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define NUMERIC_ARRAY_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure numeric_array defined by the user in the IDL file. - * @ingroup numeric_array - */ -class numeric_array -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport numeric_array(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~numeric_array(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array( - const numeric_array& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array( - numeric_array&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array& operator =( - const numeric_array& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array& operator =( - numeric_array&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x numeric_array object to compare. - */ - eProsima_user_DllExport bool operator ==( - const numeric_array& x) const; - - /*! - * @brief Comparison operator. - * @param x numeric_array object to compare. - */ - eProsima_user_DllExport bool operator !=( - const numeric_array& x) const; - - /*! - * @brief This function copies the value in member points - * @param _points New value to be copied in member points - */ - eProsima_user_DllExport void points( - const std::array& _points); - - /*! - * @brief This function moves the value in member points - * @param _points New value to be moved in member points - */ - eProsima_user_DllExport void points( - std::array&& _points); - - /*! - * @brief This function returns a constant reference to member points - * @return Constant reference to member points - */ - eProsima_user_DllExport const std::array& points() const; - - /*! - * @brief This function returns a reference to member points - * @return Reference to member points - */ - eProsima_user_DllExport std::array& points(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const numeric_array& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - std::array m_points; - -}; - - -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.cxx deleted file mode 100644 index 0bf67dac..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.cxx +++ /dev/null @@ -1,554 +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 union_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "union_struct.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include "union_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -MyUnion::MyUnion() -{ - m__d = 1; -} - -MyUnion::~MyUnion() -{ -} - -MyUnion::MyUnion( - const MyUnion& x) -{ - m__d = x.m__d; - - switch (m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = x.m_string_value; - break; - - default: - break; - } -} - -MyUnion::MyUnion( - MyUnion&& x) noexcept -{ - m__d = x.m__d; - - switch (m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = std::move(x.m_string_value); - - break; - - default: - break; - } -} - -MyUnion& MyUnion::operator =( - const MyUnion& x) -{ - m__d = x.m__d; - - switch (m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = x.m_string_value; - break; - - default: - break; - } - - return *this; -} - -MyUnion& MyUnion::operator =( - MyUnion&& x) noexcept -{ - m__d = x.m__d; - - switch (m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = std::move(x.m_string_value); - - break; - - default: - break; - } - - return *this; -} - -bool MyUnion::operator ==( - const MyUnion& x) const -{ - if (m__d != x.m__d) - { - return false; - } - - switch (m__d) - { - case 1: - return (m_octet_value == x.m_octet_value); - break; - - - case 2: - return (m_long_value == x.m_long_value); - break; - - - case 3: - return (m_string_value == x.m_string_value); - break; - - default: - break; - } - return false; -} - -bool MyUnion::operator !=( - const MyUnion& x) const -{ - return !(*this == x); -} - -void MyUnion::_d( - int32_t __d) -{ - bool b = false; - - switch (m__d) - { - case 1: - switch (__d) - { - case 1: - b = true; - break; - default: - break; - } - break; - - - case 2: - switch (__d) - { - case 2: - b = true; - break; - default: - break; - } - break; - - - case 3: - switch (__d) - { - case 3: - b = true; - break; - default: - break; - } - break; - - default: - break; - } - - if (!b) - { - throw BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; -} - -int32_t MyUnion::_d() const -{ - return m__d; -} - -int32_t& MyUnion::_d() -{ - return m__d; -} - -void MyUnion::octet_value( - uint8_t _octet_value) -{ - m_octet_value = _octet_value; - m__d = 1; - -} - -uint8_t MyUnion::octet_value() const -{ - bool b = false; - - switch (m__d) - { - case 1: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_octet_value; -} - -uint8_t& MyUnion::octet_value() -{ - bool b = false; - - switch (m__d) - { - case 1: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_octet_value; -} - - -void MyUnion::long_value( - int32_t _long_value) -{ - m_long_value = _long_value; - m__d = 2; - -} - -int32_t MyUnion::long_value() const -{ - bool b = false; - - switch (m__d) - { - case 2: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_long_value; -} - -int32_t& MyUnion::long_value() -{ - bool b = false; - - switch (m__d) - { - case 2: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_long_value; -} - - -void MyUnion::string_value( - const std::string& _string_value) -{ - m_string_value = _string_value; - m__d = 3; - -} - -void MyUnion::string_value( - std::string&& _string_value) -{ - m_string_value = std::move(_string_value); - m__d = 3; - -} - -const std::string& MyUnion::string_value() const -{ - bool b = false; - - switch (m__d) - { - case 3: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_string_value; -} - -std::string& MyUnion::string_value() -{ - bool b = false; - - switch (m__d) - { - case 3: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_string_value; -} - - - - -union_struct::union_struct() -{ - // Just to register all known types - registerunion_structTypes(); -} - -union_struct::~union_struct() -{ -} - -union_struct::union_struct( - const union_struct& x) -{ - m_index = x.m_index; - m_union_value = x.m_union_value; -} - -union_struct::union_struct( - union_struct&& x) noexcept -{ - m_index = x.m_index; - m_union_value = std::move(x.m_union_value); -} - -union_struct& union_struct::operator =( - const union_struct& x) -{ - - m_index = x.m_index; - m_union_value = x.m_union_value; - return *this; -} - -union_struct& union_struct::operator =( - union_struct&& x) noexcept -{ - - m_index = x.m_index; - m_union_value = std::move(x.m_union_value); - return *this; -} - -bool union_struct::operator ==( - const union_struct& x) const -{ - return (m_index == x.m_index && - m_union_value == x.m_union_value); -} - -bool union_struct::operator !=( - const union_struct& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void union_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t union_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& union_struct::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member union_value - * @param _union_value New value to be copied in member union_value - */ -void union_struct::union_value( - const MyUnion& _union_value) -{ - m_union_value = _union_value; -} - -/*! - * @brief This function moves the value in member union_value - * @param _union_value New value to be moved in member union_value - */ -void union_struct::union_value( - MyUnion&& _union_value) -{ - m_union_value = std::move(_union_value); -} - -/*! - * @brief This function returns a constant reference to member union_value - * @return Constant reference to member union_value - */ -const MyUnion& union_struct::union_value() const -{ - return m_union_value; -} - -/*! - * @brief This function returns a reference to member union_value - * @return Reference to member union_value - */ -MyUnion& union_struct::union_value() -{ - return m_union_value; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "union_structCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.h deleted file mode 100644 index 96b58855..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_struct.h +++ /dev/null @@ -1,357 +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 union_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include -#include "union_structv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_H_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_H_ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(UNION_STRUCT_SOURCE) -#define UNION_STRUCT_DllAPI __declspec( dllexport ) -#else -#define UNION_STRUCT_DllAPI __declspec( dllimport ) -#endif // UNION_STRUCT_SOURCE -#else -#define UNION_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define UNION_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the union MyUnion defined by the user in the IDL file. - * @ingroup union_struct - */ -class MyUnion -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MyUnion(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MyUnion(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - const MyUnion& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - MyUnion&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - const MyUnion& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - MyUnion&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MyUnion& x) const; - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MyUnion& x) const; - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - int32_t __d); - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport int32_t _d() const; - - /*! - * @brief This function returns a reference to the discriminator. - * @return Reference to the discriminator. - */ - eProsima_user_DllExport int32_t& _d(); - - /*! - * @brief This function sets a value in member octet_value - * @param _octet_value New value for member octet_value - */ - eProsima_user_DllExport void octet_value( - uint8_t _octet_value); - - /*! - * @brief This function returns the value of member octet_value - * @return Value of member octet_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t octet_value() const; - - /*! - * @brief This function returns a reference to member octet_value - * @return Reference to member octet_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t& octet_value(); - - - /*! - * @brief This function sets a value in member long_value - * @param _long_value New value for member long_value - */ - eProsima_user_DllExport void long_value( - int32_t _long_value); - - /*! - * @brief This function returns the value of member long_value - * @return Value of member long_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t long_value() const; - - /*! - * @brief This function returns a reference to member long_value - * @return Reference to member long_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t& long_value(); - - - /*! - * @brief This function copies the value in member string_value - * @param _string_value New value to be copied in member string_value - */ - eProsima_user_DllExport void string_value( - const std::string& _string_value); - - /*! - * @brief This function moves the value in member string_value - * @param _string_value New value to be moved in member string_value - */ - eProsima_user_DllExport void string_value( - std::string&& _string_value); - - /*! - * @brief This function returns a constant reference to member string_value - * @return Constant reference to member string_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::string& string_value() const; - - /*! - * @brief This function returns a reference to member string_value - * @return Reference to member string_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::string& string_value(); - -private: - - int32_t m__d; - - uint8_t m_octet_value{0}; - int32_t m_long_value{0}; - std::string m_string_value; -}; - - -/*! - * @brief This class represents the structure union_struct defined by the user in the IDL file. - * @ingroup union_struct - */ -class union_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport union_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~union_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - const union_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - union_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - const union_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - union_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const union_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const union_struct& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - - /*! - * @brief This function copies the value in member union_value - * @param _union_value New value to be copied in member union_value - */ - eProsima_user_DllExport void union_value( - const MyUnion& _union_value); - - /*! - * @brief This function moves the value in member union_value - * @param _union_value New value to be moved in member union_value - */ - eProsima_user_DllExport void union_value( - MyUnion&& _union_value); - - /*! - * @brief This function returns a constant reference to member union_value - * @return Constant reference to member union_value - */ - eProsima_user_DllExport const MyUnion& union_value() const; - - /*! - * @brief This function returns a reference to member union_value - * @return Reference to member union_value - */ - eProsima_user_DllExport MyUnion& union_value(); - -private: - - uint32_t m_index{0}; - MyUnion m_union_value; - -}; - -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_H_ - - - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.cxx deleted file mode 100644 index b4834bfb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.cxx +++ /dev/null @@ -1,547 +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 union_structTypeObject.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { char dummy; } -#endif - -#include "union_struct.h" -#include "union_structTypeObject.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace eprosima::fastrtps::rtps; - -void registerunion_structTypes() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - TypeObjectFactory *factory = TypeObjectFactory::get_instance(); - factory->add_type_object("MyUnion", GetMyUnionIdentifier(true), - GetMyUnionObject(true)); - factory->add_type_object("MyUnion", GetMyUnionIdentifier(false), - GetMyUnionObject(false)); - - - factory->add_type_object("union_struct", Getunion_structIdentifier(true), - Getunion_structObject(true)); - factory->add_type_object("union_struct", Getunion_structIdentifier(false), - Getunion_structObject(false)); - - }); -} - - - -const TypeIdentifier* GetMyUnionIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("MyUnion", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - GetMyUnionObject(complete); - return TypeObjectFactory::get_instance()->get_type_identifier("MyUnion", complete); -} - -const TypeObject* GetMyUnionObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MyUnion", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteMyUnionObject(); - } - // else - return GetMinimalMyUnionObject(); -} - -const TypeObject* GetMinimalMyUnionObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MyUnion", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_UNION); - - type_object->minimal().union_type().union_flags().IS_FINAL(false); - type_object->minimal().union_type().union_flags().IS_APPENDABLE(false); - type_object->minimal().union_type().union_flags().IS_MUTABLE(false); - type_object->minimal().union_type().union_flags().IS_NESTED(false); - type_object->minimal().union_type().union_flags().IS_AUTOID_HASH(false); // Unsupported - - type_object->minimal().union_type().discriminator().common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - type_object->minimal().union_type().discriminator().common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - type_object->minimal().union_type().discriminator().common().member_flags().IS_EXTERNAL(false); // Doesn't apply - type_object->minimal().union_type().discriminator().common().member_flags().IS_OPTIONAL(false); // Doesn't apply - type_object->minimal().union_type().discriminator().common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - type_object->minimal().union_type().discriminator().common().member_flags().IS_KEY(false); // Unsupported - type_object->minimal().union_type().discriminator().common().member_flags().IS_DEFAULT(false); // Doesn't apply - - type_object->minimal().union_type().discriminator().common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - MemberId memberId = 0; - MinimalUnionMember mst_octet_value; - mst_octet_value.common().member_id(memberId++); - mst_octet_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_octet_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_octet_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_octet_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - mst_octet_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mst_octet_value.common().member_flags().IS_KEY(false); // Doesn't apply - mst_octet_value.common().member_flags().IS_DEFAULT(false); - mst_octet_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint8_t", false)); - - - mst_octet_value.common().label_seq().emplace_back(1); - - MD5 octet_value_hash("octet_value"); - for(int i = 0; i < 4; ++i) - { - mst_octet_value.detail().name_hash()[i] = octet_value_hash.digest[i]; - } - type_object->minimal().union_type().member_seq().emplace_back(mst_octet_value); - - MinimalUnionMember mst_long_value; - mst_long_value.common().member_id(memberId++); - mst_long_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_long_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_long_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_long_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - mst_long_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mst_long_value.common().member_flags().IS_KEY(false); // Doesn't apply - mst_long_value.common().member_flags().IS_DEFAULT(false); - mst_long_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - - mst_long_value.common().label_seq().emplace_back(2); - - MD5 long_value_hash("long_value"); - for(int i = 0; i < 4; ++i) - { - mst_long_value.detail().name_hash()[i] = long_value_hash.digest[i]; - } - type_object->minimal().union_type().member_seq().emplace_back(mst_long_value); - - MinimalUnionMember mst_string_value; - mst_string_value.common().member_id(memberId++); - mst_string_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_string_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_string_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_string_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - mst_string_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - mst_string_value.common().member_flags().IS_KEY(false); // Doesn't apply - mst_string_value.common().member_flags().IS_DEFAULT(false); - mst_string_value.common().type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - - mst_string_value.common().label_seq().emplace_back(3); - - MD5 string_value_hash("string_value"); - for(int i = 0; i < 4; ++i) - { - mst_string_value.detail().name_hash()[i] = string_value_hash.digest[i]; - } - type_object->minimal().union_type().member_seq().emplace_back(mst_string_value); - - - // Header - //type_object->minimal().union_type().header().detail()... // Empty - - TypeIdentifier* identifier = new TypeIdentifier(); - identifier->_d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().union_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier->equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MyUnion", identifier, type_object); - delete type_object; - delete identifier; - return TypeObjectFactory::get_instance()->get_type_object("MyUnion", false); -} - -const TypeObject* GetCompleteMyUnionObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("MyUnion", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_UNION); - - type_object->complete().union_type().union_flags().IS_FINAL(false); - type_object->complete().union_type().union_flags().IS_APPENDABLE(false); - type_object->complete().union_type().union_flags().IS_MUTABLE(false); - type_object->complete().union_type().union_flags().IS_NESTED(false); - type_object->complete().union_type().union_flags().IS_AUTOID_HASH(false); // Unsupported - - type_object->complete().union_type().discriminator().common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - type_object->complete().union_type().discriminator().common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - type_object->complete().union_type().discriminator().common().member_flags().IS_EXTERNAL(false); // Doesn't apply - type_object->complete().union_type().discriminator().common().member_flags().IS_OPTIONAL(false); // Doesn't apply - type_object->complete().union_type().discriminator().common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - type_object->complete().union_type().discriminator().common().member_flags().IS_KEY(false); // Unsupported - type_object->complete().union_type().discriminator().common().member_flags().IS_DEFAULT(false); // Doesn't apply - - type_object->complete().union_type().discriminator().common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - MemberId memberId = 0; - CompleteUnionMember cst_octet_value; - cst_octet_value.common().member_id(memberId++); - cst_octet_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_octet_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_octet_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_octet_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - cst_octet_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cst_octet_value.common().member_flags().IS_KEY(false); // Doesn't apply - cst_octet_value.common().member_flags().IS_DEFAULT(false); - cst_octet_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint8_t", false)); - - cst_octet_value.common().label_seq().emplace_back(1); - - - cst_octet_value.detail().name("octet_value"); - - type_object->complete().union_type().member_seq().emplace_back(cst_octet_value); - - CompleteUnionMember cst_long_value; - cst_long_value.common().member_id(memberId++); - cst_long_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_long_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_long_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_long_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - cst_long_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cst_long_value.common().member_flags().IS_KEY(false); // Doesn't apply - cst_long_value.common().member_flags().IS_DEFAULT(false); - cst_long_value.common().type_id(*TypeObjectFactory::get_instance()->get_type_identifier("int32_t", false)); - - cst_long_value.common().label_seq().emplace_back(2); - - - cst_long_value.detail().name("long_value"); - - type_object->complete().union_type().member_seq().emplace_back(cst_long_value); - - CompleteUnionMember cst_string_value; - cst_string_value.common().member_id(memberId++); - cst_string_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_string_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_string_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_string_value.common().member_flags().IS_OPTIONAL(false); // Doesn't apply - cst_string_value.common().member_flags().IS_MUST_UNDERSTAND(false); // Doesn't apply - cst_string_value.common().member_flags().IS_KEY(false); // Doesn't apply - cst_string_value.common().member_flags().IS_DEFAULT(false); - cst_string_value.common().type_id(*TypeObjectFactory::get_instance()->get_string_identifier(255, false)); - cst_string_value.common().label_seq().emplace_back(3); - - - cst_string_value.detail().name("string_value"); - - type_object->complete().union_type().member_seq().emplace_back(cst_string_value); - - - // Header - type_object->complete().union_type().header().detail().type_name("MyUnion"); - - TypeIdentifier* identifier = new TypeIdentifier(); - identifier->_d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().union_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier->equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("MyUnion", identifier, type_object); - delete type_object; - delete identifier; - return TypeObjectFactory::get_instance()->get_type_object("MyUnion", true); -} - - - -const TypeIdentifier* Getunion_structIdentifier(bool complete) -{ - const TypeIdentifier * c_identifier = TypeObjectFactory::get_instance()->get_type_identifier("union_struct", complete); - if (c_identifier != nullptr && (!complete || c_identifier->_d() == EK_COMPLETE)) - { - return c_identifier; - } - - Getunion_structObject(complete); // Generated inside - return TypeObjectFactory::get_instance()->get_type_identifier("union_struct", complete); -} - -const TypeObject* Getunion_structObject(bool complete) -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("union_struct", complete); - if (c_type_object != nullptr) - { - return c_type_object; - } - else if (complete) - { - return GetCompleteunion_structObject(); - } - //else - return GetMinimalunion_structObject(); -} - -const TypeObject* GetMinimalunion_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("union_struct", false); - if (c_type_object != nullptr) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_MINIMAL); - type_object->minimal()._d(TK_STRUCTURE); - - type_object->minimal().struct_type().struct_flags().IS_FINAL(false); - type_object->minimal().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->minimal().struct_type().struct_flags().IS_MUTABLE(false); - type_object->minimal().struct_type().struct_flags().IS_NESTED(false); - type_object->minimal().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - MinimalStructMember mst_index; - mst_index.common().member_id(memberId++); - mst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_index.common().member_flags().IS_OPTIONAL(false); - mst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_index.common().member_flags().IS_KEY(false); - mst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - MD5 index_hash("index"); - for(int i = 0; i < 4; ++i) - { - mst_index.detail().name_hash()[i] = index_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_index); - - MinimalStructMember mst_union_value; - mst_union_value.common().member_id(memberId++); - mst_union_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - mst_union_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - mst_union_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - mst_union_value.common().member_flags().IS_OPTIONAL(false); - mst_union_value.common().member_flags().IS_MUST_UNDERSTAND(false); - mst_union_value.common().member_flags().IS_KEY(false); - mst_union_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - mst_union_value.common().member_type_id(*GetMyUnionIdentifier(false)); - - MD5 union_value_hash("union_value"); - for(int i = 0; i < 4; ++i) - { - mst_union_value.detail().name_hash()[i] = union_value_hash.digest[i]; - } - type_object->minimal().struct_type().member_seq().emplace_back(mst_union_value); - - - // Header - // TODO Inheritance - //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); - //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - TypeIdentifier identifier; - identifier._d(EK_MINIMAL); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->minimal().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("union_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("union_struct", false); -} - -const TypeObject* GetCompleteunion_structObject() -{ - const TypeObject* c_type_object = TypeObjectFactory::get_instance()->get_type_object("union_struct", true); - if (c_type_object != nullptr && c_type_object->_d() == EK_COMPLETE) - { - return c_type_object; - } - - TypeObject *type_object = new TypeObject(); - type_object->_d(EK_COMPLETE); - type_object->complete()._d(TK_STRUCTURE); - - type_object->complete().struct_type().struct_flags().IS_FINAL(false); - type_object->complete().struct_type().struct_flags().IS_APPENDABLE(false); - type_object->complete().struct_type().struct_flags().IS_MUTABLE(false); - type_object->complete().struct_type().struct_flags().IS_NESTED(false); - type_object->complete().struct_type().struct_flags().IS_AUTOID_HASH(false); // Unsupported - - MemberId memberId = 0; - CompleteStructMember cst_index; - cst_index.common().member_id(memberId++); - cst_index.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_index.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_index.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_index.common().member_flags().IS_OPTIONAL(false); - cst_index.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_index.common().member_flags().IS_KEY(false); - cst_index.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_index.common().member_type_id(*TypeObjectFactory::get_instance()->get_type_identifier("uint32_t", false)); - - - cst_index.detail().name("index"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_index); - - CompleteStructMember cst_union_value; - cst_union_value.common().member_id(memberId++); - cst_union_value.common().member_flags().TRY_CONSTRUCT1(false); // Unsupported - cst_union_value.common().member_flags().TRY_CONSTRUCT2(false); // Unsupported - cst_union_value.common().member_flags().IS_EXTERNAL(false); // Unsupported - cst_union_value.common().member_flags().IS_OPTIONAL(false); - cst_union_value.common().member_flags().IS_MUST_UNDERSTAND(false); - cst_union_value.common().member_flags().IS_KEY(false); - cst_union_value.common().member_flags().IS_DEFAULT(false); // Doesn't apply - cst_union_value.common().member_type_id(*GetMyUnionIdentifier(true)); - - cst_union_value.detail().name("union_value"); - - type_object->complete().struct_type().member_seq().emplace_back(cst_union_value); - - - // Header - type_object->complete().struct_type().header().detail().type_name("union_struct"); - // TODO inheritance - TypeIdentifier identifier; - identifier._d(EK_COMPLETE); - - eprosima::fastcdr::CdrSizeCalculator calculator(eprosima::fastcdr::CdrVersion::XCDRv1); - size_t current_alignment {0}; - SerializedPayload_t payload(static_cast( - calculator.calculate_serialized_size(type_object->complete().struct_type(), current_alignment) + 4)); - eprosima::fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size); - // Fixed endian (Page 221, EquivalenceHash definition of Extensible and Dynamic Topic Types for DDS document) - eprosima::fastcdr::Cdr ser( - fastbuffer, eprosima::fastcdr::Cdr::LITTLE_ENDIANNESS, - eprosima::fastcdr::CdrVersion::XCDRv1); // Object that serializes the data. - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - ser << *type_object; -#if FASTCDR_VERSION_MAJOR == 1 - payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length -#else - payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length -#endif // FASTCDR_VERSION_MAJOR == 1 - MD5 objectHash; - objectHash.update((char*)payload.data, payload.length); - objectHash.finalize(); - for(int i = 0; i < 14; ++i) - { - identifier.equivalence_hash()[i] = objectHash.digest[i]; - } - - TypeObjectFactory::get_instance()->add_type_object("union_struct", &identifier, type_object); - delete type_object; - return TypeObjectFactory::get_instance()->get_type_object("union_struct", true); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.h deleted file mode 100644 index 069b41a1..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structTypeObject.h +++ /dev/null @@ -1,72 +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 union_structTypeObject.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_H_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_H_ - - -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif -#else -#define eProsima_user_DllExport -#endif - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(union_struct_SOURCE) -#define union_struct_DllAPI __declspec( dllexport ) -#else -#define union_struct_DllAPI __declspec( dllimport ) -#endif // union_struct_SOURCE -#else -#define union_struct_DllAPI -#endif -#else -#define union_struct_DllAPI -#endif // _WIN32 - -using namespace eprosima::fastrtps::types; - -eProsima_user_DllExport void registerunion_structTypes(); - - - -eProsima_user_DllExport const TypeIdentifier* GetMyUnionIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMyUnionObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalMyUnionObject(); -eProsima_user_DllExport const TypeObject* GetCompleteMyUnionObject(); - - - -eProsima_user_DllExport const TypeIdentifier* Getunion_structIdentifier(bool complete = false); -eProsima_user_DllExport const TypeObject* Getunion_structObject(bool complete = false); -eProsima_user_DllExport const TypeObject* GetMinimalunion_structObject(); -eProsima_user_DllExport const TypeObject* GetCompleteunion_structObject(); - - -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_H_ \ No newline at end of file diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.cxx deleted file mode 100644 index 06b92f82..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.cxx +++ /dev/null @@ -1,780 +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 union_struct.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "union_struct.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include "union_structTypeObject.h" - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define union_struct_max_cdr_typesize 276ULL; - - - - - -MyUnion::MyUnion() -{ - m__d = 1; - // octet m_octet_value - m_octet_value = 0; - // long m_long_value - m_long_value = 0; - // /type_d() m_string_value - -} - -MyUnion::~MyUnion() -{ -} - -MyUnion::MyUnion( - const MyUnion& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = x.m_string_value; - break; - - default: - break; - } -} - -MyUnion::MyUnion( - MyUnion&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = std::move(x.m_string_value); - - break; - - default: - break; - } -} - -MyUnion& MyUnion::operator =( - const MyUnion& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = x.m_string_value; - break; - - default: - break; - } - - return *this; -} - -MyUnion& MyUnion::operator =( - MyUnion&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case 1: - m_octet_value = x.m_octet_value; - break; - - - case 2: - m_long_value = x.m_long_value; - break; - - - case 3: - m_string_value = std::move(x.m_string_value); - - break; - - default: - break; - } - - return *this; -} - -bool MyUnion::operator ==( - const MyUnion& x) const -{ - if (m__d != x.m__d) - { - return false; - } - - switch(m__d) - { - case 1: - return (m_octet_value == x.m_octet_value); - break; - - - case 2: - return (m_long_value == x.m_long_value); - break; - - - case 3: - return (m_string_value == x.m_string_value); - break; - - default: - break; - } - return false; -} - -bool MyUnion::operator !=( - const MyUnion& x) const -{ - return !(*this == x); -} - -void MyUnion::_d( - int32_t __d) -{ - bool b = false; - - switch(m__d) - { - case 1: - switch(__d) - { - case 1: - b = true; - break; - default: - break; - } - break; - - - case 2: - switch(__d) - { - case 2: - b = true; - break; - default: - break; - } - break; - - - case 3: - switch(__d) - { - case 3: - b = true; - break; - default: - break; - } - break; - - } - - if(!b) - { - throw BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; -} - -int32_t MyUnion::_d() const -{ - return m__d; -} - -int32_t& MyUnion::_d() -{ - return m__d; -} - -void MyUnion::octet_value( - uint8_t _octet_value) -{ - m_octet_value = _octet_value; - m__d = 1; - -} - -uint8_t MyUnion::octet_value() const -{ - bool b = false; - - switch(m__d) - { - case 1: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_octet_value; -} - -uint8_t& MyUnion::octet_value() -{ - bool b = false; - - switch(m__d) - { - case 1: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_octet_value; -} - - -void MyUnion::long_value( - int32_t _long_value) -{ - m_long_value = _long_value; - m__d = 2; - -} - -int32_t MyUnion::long_value() const -{ - bool b = false; - - switch(m__d) - { - case 2: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_long_value; -} - -int32_t& MyUnion::long_value() -{ - bool b = false; - - switch(m__d) - { - case 2: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_long_value; -} - - -void MyUnion::string_value( - const std::string& _string_value) -{ - m_string_value = _string_value; - m__d = 3; - -} - -void MyUnion::string_value( - std::string&& _string_value) -{ - m_string_value = std::move(_string_value); - m__d = 3; - -} - -const std::string& MyUnion::string_value() const -{ - bool b = false; - - switch(m__d) - { - case 3: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_string_value; -} - -std::string& MyUnion::string_value() -{ - bool b = false; - - switch(m__d) - { - case 3: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_string_value; -} - - -// TODO(Ricardo) Review -size_t MyUnion::getCdrSerializedSize( - const MyUnion& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - switch(data.m__d) - { - case 1: - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - break; - - - case 2: - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - break; - - - case 3: - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.string_value().size() + 1; - - break; - - default: - break; - } - - return current_alignment - initial_alignment; -} - - -void MyUnion::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m__d; - - switch(m__d) - { - case 1: - scdr << m_octet_value; - - break; - - - case 2: - scdr << m_long_value; - - break; - - - case 3: - scdr << m_string_value.c_str(); - - break; - - default: - break; - } -} - -void MyUnion::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m__d; - - - switch(m__d) - { - case 1: - dcdr >> m_octet_value; - - - break; - - - case 2: - dcdr >> m_long_value; - - - break; - - - case 3: - dcdr >> m_string_value; - - - break; - - default: - break; - } -} - - - - - -union_struct::union_struct() -{ - // unsigned long m_index - m_index = 0; - // MyUnion m_union_value - - - // Just to register all known types - registerunion_structTypes(); -} - -union_struct::~union_struct() -{ -} - -union_struct::union_struct( - const union_struct& x) -{ - m_index = x.m_index; - - - m_union_value = x.m_union_value; - -} - -union_struct::union_struct( - union_struct&& x) noexcept -{ - m_index = x.m_index; - - - m_union_value = std::move(x.m_union_value); - -} - -union_struct& union_struct::operator =( - const union_struct& x) -{ - m_index = x.m_index; - - - m_union_value = x.m_union_value; - - return *this; -} - -union_struct& union_struct::operator =( - union_struct&& x) noexcept -{ - m_index = x.m_index; - - - m_union_value = std::move(x.m_union_value); - - return *this; -} - -bool union_struct::operator ==( - const union_struct& x) const -{ - return (m_index == x.m_index && - m_union_value == x.m_union_value); -} - -bool union_struct::operator !=( - const union_struct& x) const -{ - return !(*this == x); -} - -size_t union_struct::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return union_struct_max_cdr_typesize; -} - -size_t union_struct::getCdrSerializedSize( - const union_struct& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += MyUnion::getCdrSerializedSize(data.union_value(), current_alignment); - - - return current_alignment - initial_alignment; -} - - -void union_struct::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_index; - - scdr << m_union_value; - -} - -void union_struct::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_index; - - - - dcdr >> m_union_value; - - -} - - -bool union_struct::isKeyDefined() -{ - return false; -} - -void union_struct::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void union_struct::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t union_struct::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& union_struct::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member union_value - * @param _union_value New value to be copied in member union_value - */ -void union_struct::union_value( - const MyUnion& _union_value) -{ - m_union_value = _union_value; -} - -/*! - * @brief This function moves the value in member union_value - * @param _union_value New value to be moved in member union_value - */ -void union_struct::union_value( - MyUnion&& _union_value) -{ - m_union_value = std::move(_union_value); -} - -/*! - * @brief This function returns a constant reference to member union_value - * @return Constant reference to member union_value - */ -const MyUnion& union_struct::union_value() const -{ - return m_union_value; -} - -/*! - * @brief This function returns a reference to member union_value - * @return Reference to member union_value - */ -MyUnion& union_struct::union_value() -{ - return m_union_value; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.h b/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.h deleted file mode 100644 index 784ae7e7..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/v2/type_objects/union_structv1.h +++ /dev/null @@ -1,437 +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 union_struct.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_H_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(UNION_STRUCT_SOURCE) -#define UNION_STRUCT_DllAPI __declspec( dllexport ) -#else -#define UNION_STRUCT_DllAPI __declspec( dllimport ) -#endif // UNION_STRUCT_SOURCE -#else -#define UNION_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define UNION_STRUCT_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the union MyUnion defined by the user in the IDL file. - * @ingroup union_struct - */ -class MyUnion -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MyUnion(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MyUnion(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - const MyUnion& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - MyUnion&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - const MyUnion& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - MyUnion&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MyUnion& x) const; - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MyUnion& x) const; - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - int32_t __d); - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport int32_t _d() const; - - /*! - * @brief This function returns a reference to the discriminator. - * @return Reference to the discriminator. - */ - eProsima_user_DllExport int32_t& _d(); - - /*! - * @brief This function sets a value in member octet_value - * @param _octet_value New value for member octet_value - */ - eProsima_user_DllExport void octet_value( - uint8_t _octet_value); - - /*! - * @brief This function returns the value of member octet_value - * @return Value of member octet_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t octet_value() const; - - /*! - * @brief This function returns a reference to member octet_value - * @return Reference to member octet_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t& octet_value(); - - - /*! - * @brief This function sets a value in member long_value - * @param _long_value New value for member long_value - */ - eProsima_user_DllExport void long_value( - int32_t _long_value); - - /*! - * @brief This function returns the value of member long_value - * @return Value of member long_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t long_value() const; - - /*! - * @brief This function returns a reference to member long_value - * @return Reference to member long_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t& long_value(); - - - /*! - * @brief This function copies the value in member string_value - * @param _string_value New value to be copied in member string_value - */ - eProsima_user_DllExport void string_value( - const std::string& _string_value); - - /*! - * @brief This function moves the value in member string_value - * @param _string_value New value to be moved in member string_value - */ - eProsima_user_DllExport void string_value( - std::string&& _string_value); - - /*! - * @brief This function returns a constant reference to member string_value - * @return Constant reference to member string_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::string& string_value() const; - - /*! - * @brief This function returns a reference to member string_value - * @return Reference to member string_value - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::string& string_value(); - - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const MyUnion& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - -private: - - int32_t m__d; - - uint8_t m_octet_value; - int32_t m_long_value; - std::string m_string_value; -}; - - - -/*! - * @brief This class represents the structure union_struct defined by the user in the IDL file. - * @ingroup union_struct - */ -class union_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport union_struct(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~union_struct(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - const union_struct& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - union_struct&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - const union_struct& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - union_struct&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const union_struct& x) const; - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const union_struct& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - - /*! - * @brief This function copies the value in member union_value - * @param _union_value New value to be copied in member union_value - */ - eProsima_user_DllExport void union_value( - const MyUnion& _union_value); - - /*! - * @brief This function moves the value in member union_value - * @param _union_value New value to be moved in member union_value - */ - eProsima_user_DllExport void union_value( - MyUnion&& _union_value); - - /*! - * @brief This function returns a constant reference to member union_value - * @return Constant reference to member union_value - */ - eProsima_user_DllExport const MyUnion& union_value() const; - - /*! - * @brief This function returns a reference to member union_value - * @return Reference to member union_value - */ - eProsima_user_DllExport MyUnion& union_value(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const union_struct& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - uint32_t m_index; - MyUnion m_union_value; - -}; - - -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/ddspipe_core/test/unittest/types/endpoint/CMakeLists.txt b/ddspipe_core/test/unittest/types/endpoint/CMakeLists.txt index dfc2ce5f..41e58633 100644 --- a/ddspipe_core/test/unittest/types/endpoint/CMakeLists.txt +++ b/ddspipe_core/test/unittest/types/endpoint/CMakeLists.txt @@ -30,7 +30,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) @@ -69,7 +69,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_core/test/unittest/types/topic/CMakeLists.txt b/ddspipe_core/test/unittest/types/topic/CMakeLists.txt index 863b02ec..82ab2b08 100644 --- a/ddspipe_core/test/unittest/types/topic/CMakeLists.txt +++ b/ddspipe_core/test/unittest/types/topic/CMakeLists.txt @@ -32,7 +32,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ) @@ -70,7 +70,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES $<$:iphlpapi$Shlwapi> fastcdr - fastrtps + fastdds cpp_utils ) diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index e3e23896..c3f90745 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -108,15 +108,18 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain virtual void on_participant_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info) override; + fastrtps::rtps::ParticipantDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; - virtual void on_subscriber_discovery( + virtual void on_data_reader_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info) override; + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; - virtual void on_publisher_discovery( + virtual void on_data_writer_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info) override; + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; protected: diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 928d1849..68d39a82 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -19,8 +19,11 @@ #pragma once #include +#include #include +#include + #include #include #include @@ -72,29 +75,29 @@ class DynTypesParticipant : public rtps::SimpleParticipant, public eprosima::fas const core::ITopic& topic) override; DDSPIPE_PARTICIPANTS_DllAPI - void on_type_discovery( - eprosima::fastdds::dds::DomainParticipant* participant, - const eprosima::fastrtps::rtps::SampleIdentity& request_sample_id, - const eprosima::fastrtps::string_255& topic, - const eprosima::fastrtps::types::TypeIdentifier* identifier, - const eprosima::fastrtps::types::TypeObject* object, - eprosima::fastrtps::types::DynamicType_ptr dyn_type) override; + void on_data_reader_discovery( + fastdds::dds::DomainParticipant* participant, + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; DDSPIPE_PARTICIPANTS_DllAPI - virtual void on_type_information_received( - eprosima::fastdds::dds::DomainParticipant* participant, - const eprosima::fastrtps::string_255 topic_name, - const eprosima::fastrtps::string_255 type_name, - const eprosima::fastrtps::types::TypeInformation& type_information) override; + void on_data_writer_discovery( + fastdds::dds::DomainParticipant* participant, + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; protected: + void on_type_discovery_( + fastdds::dds::DomainParticipant* participant, + const fastdds::dds::xtypes::TypeInformation& type_info); + void internal_notify_type_object_( - eprosima::fastrtps::types::DynamicType_ptr dynamic_type); + fastdds::dds::DynamicType::_ref_type dynamic_type); void initialize_internal_dds_participant_(); - eprosima::fastdds::dds::DomainParticipant* dds_participant_; + fastdds::dds::DomainParticipant* dds_participant_; //! Type Object Internal Reader std::shared_ptr type_object_reader_; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp index 3e0351a7..136e46fe 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include @@ -35,7 +35,7 @@ class ISchemaHandler public: virtual void add_schema( - const fastrtps::types::DynamicType_ptr& dynamic_type) = 0; + const fastdds::dds::DynamicType::_ref_type& dynamic_type) = 0; virtual void add_data( const core::types::DdsTopic& topic, diff --git a/ddspipe_participants/include/ddspipe_participants/reader/dds/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/dds/CommonReader.hpp index 2d6e0c0f..56a7c4bc 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/dds/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/dds/CommonReader.hpp @@ -16,6 +16,7 @@ #include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index bf3f11f2..081798cb 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -16,6 +16,7 @@ #include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/testing/entities/mock_entities.hpp b/ddspipe_participants/include/ddspipe_participants/testing/entities/mock_entities.hpp index cd6283ba..ced5f115 100644 --- a/ddspipe_participants/include/ddspipe_participants/testing/entities/mock_entities.hpp +++ b/ddspipe_participants/include/ddspipe_participants/testing/entities/mock_entities.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index 14cd35eb..f42bff0a 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -17,8 +17,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/ddspipe_participants/package.xml b/ddspipe_participants/package.xml index eeb13bd8..b79728cf 100644 --- a/ddspipe_participants/package.xml +++ b/ddspipe_participants/package.xml @@ -16,7 +16,7 @@ cmake - fastrtps + fastdds cpp_utils cmake_utils ddspipe_core diff --git a/ddspipe_participants/project_settings.cmake b/ddspipe_participants/project_settings.cmake index 98d8dff1..76306296 100644 --- a/ddspipe_participants/project_settings.cmake +++ b/ddspipe_participants/project_settings.cmake @@ -26,12 +26,12 @@ set(MODULE_SUMMARY set(MODULE_FIND_PACKAGES fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ) -set(fastrtps_MINIMUM_VERSION "2.8") +set(fastdds_MINIMUM_VERSION "3.0.0") set(MODULE_DEPENDENCIES $<$:iphlpapi$Shlwapi> diff --git a/ddspipe_participants/src/cpp/configuration/XmlParticipantConfiguration.cpp b/ddspipe_participants/src/cpp/configuration/XmlParticipantConfiguration.cpp index 0d21b15e..c6dd1734 100644 --- a/ddspipe_participants/src/cpp/configuration/XmlParticipantConfiguration.cpp +++ b/ddspipe_participants/src/cpp/configuration/XmlParticipantConfiguration.cpp @@ -13,8 +13,8 @@ // limitations under the License. #include -#include +#include #include #include @@ -39,7 +39,7 @@ bool XmlParticipantConfiguration::is_valid( participant_profile.get_value(), qos); - if (res != utils::ReturnCode::RETCODE_OK) + if (res != fastdds::dds::RETCODE_OK) { error_msg << "Profile " << participant_profile.get_value() << " is not loaded in XML. "; return false; diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 11982ba4..261c6484 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -16,6 +16,7 @@ #include +#include #include #include @@ -90,7 +91,7 @@ void CommonParticipant::init() throw utils::InitializationException(STR_ENTRY << "Error creating DDS Participant " << id() << "."); } - if (dds_participant_->enable() != utils::ReturnCode::RETCODE_OK) + if (dds_participant_->enable() != fastdds::dds::RETCODE_OK) { throw utils::InitializationException(STR_ENTRY << "Error enabling DDS Participant " << id() << "."); } @@ -216,7 +217,8 @@ std::shared_ptr CommonParticipant::create_reader( void CommonParticipant::on_participant_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info) + fastrtps::rtps::ParticipantDiscoveryInfo&& info, + bool&) { if (info.info.m_guid.guidPrefix != participant->guid().guidPrefix) { @@ -244,9 +246,10 @@ void CommonParticipant::on_participant_discovery( } } -void CommonParticipant::on_subscriber_discovery( +void CommonParticipant::on_data_reader_discovery( fastdds::dds::DomainParticipant*, - fastrtps::rtps::ReaderDiscoveryInfo&& info) + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool&) { // If reader is from other participant, store it in discovery database if (detail::come_from_same_participant_(info.info.guid(), this->dds_participant_->guid())) @@ -289,9 +292,10 @@ void CommonParticipant::on_subscriber_discovery( } } -void CommonParticipant::on_publisher_discovery( +void CommonParticipant::on_data_writer_discovery( fastdds::dds::DomainParticipant*, - fastrtps::rtps::WriterDiscoveryInfo&& info) + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool&) { // If writer is from other participant, store it in discovery database if (detail::come_from_same_participant_(info.info.guid(), this->dds_participant_->guid())) diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index a4b08208..83967bc6 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -14,13 +14,13 @@ #include -#include - +#include #include -#include +// #include #include #include +#include #include #include @@ -32,9 +32,6 @@ namespace participants { namespace dds { -using namespace eprosima::fastrtps::xmlparser; - - XmlParticipant::XmlParticipant( const std::shared_ptr& participant_configuration, const std::shared_ptr& payload_pool, @@ -42,15 +39,15 @@ XmlParticipant::XmlParticipant( : CommonParticipant(participant_configuration, payload_pool, discovery_database) , xml_specific_configuration_(*reinterpret_cast(configuration_.get())) { - // Replace the configuration's domain with the XML's domainId - eprosima::fastrtps::ParticipantAttributes attr; - - if (xml_specific_configuration_.participant_profile.is_set() && - XMLProfileManager::fillParticipantAttributes(xml_specific_configuration_.participant_profile - .get_value(), attr) == XMLP_ret::XML_OK) - { - configuration_->domain = attr.domainId; - } + // // Replace the configuration's domain with the XML's domainId + // eprosima::fastrtps::ParticipantAttributes attr; + + // if (xml_specific_configuration_.participant_profile.is_set() && + // XMLProfileManager::fillParticipantAttributes(xml_specific_configuration_.participant_profile + // .get_value(), attr) == XMLP_ret::XML_OK) + // { + // configuration_->domain = attr.domainId; + // } } std::shared_ptr XmlParticipant::create_writer( @@ -99,7 +96,7 @@ fastdds::dds::DomainParticipantQos XmlParticipant::reckon_participant_qos_() con qos ); - if (res != fastrtps::types::ReturnCode_t::ReturnCodeValue::RETCODE_OK) + if (res != fastdds::dds::RETCODE_OK) { throw utils::ConfigurationException(STR_ENTRY << "Participant profile <" << xml_specific_configuration_.participant_profile.get_value() diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 4cbbaf9e..2c5ceaaf 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -23,12 +23,13 @@ #include #include #include -#include -#include -#include +#include +// #include #include #include #include +#include +#include #include #include @@ -45,7 +46,7 @@ namespace participants { using namespace eprosima::ddspipe::core; using namespace eprosima::ddspipe::core::types; -using namespace eprosima::fastrtps::types; +using namespace eprosima::fastdds::dds::xtypes; DynTypesParticipant::DynTypesParticipant( std::shared_ptr participant_configuration, @@ -94,85 +95,62 @@ std::shared_ptr DynTypesParticipant::create_reader( return rtps::SimpleParticipant::create_reader(topic); } -void DynTypesParticipant::on_type_discovery( - eprosima::fastdds::dds::DomainParticipant* /* participant */, - const fastrtps::rtps::SampleIdentity& /* request_sample_id */, - const fastrtps::string_255& /* topic */, - const fastrtps::types::TypeIdentifier* identifier, - const fastrtps::types::TypeObject* object, - fastrtps::types::DynamicType_ptr dyn_type) +void DynTypesParticipant::on_data_reader_discovery( + fastdds::dds::DomainParticipant* participant, + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool&) { - if (nullptr != dyn_type) - { - // Register type obj in singleton factory - TypeObjectFactory::get_instance()->add_type_object( - dyn_type->get_name(), identifier, object); - internal_notify_type_object_(dyn_type); - } + // Get type information + const auto type_info = info.info.type_information().type_information; + on_type_discovery_(participant, type_info); } -void DynTypesParticipant::on_type_information_received( - eprosima::fastdds::dds::DomainParticipant* participant, - const fastrtps::string_255 /* topic_name */, - const fastrtps::string_255 type_name, - const fastrtps::types::TypeInformation& type_information) +void DynTypesParticipant::on_data_writer_discovery( + fastdds::dds::DomainParticipant* participant, + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool&) { - std::string type_name_ = type_name.to_string(); - const TypeIdentifier* type_identifier = nullptr; - const TypeObject* type_object = nullptr; - DynamicType_ptr dynamic_type(nullptr); - - // Check if complete identifier already present in factory - type_identifier = TypeObjectFactory::get_instance()->get_type_identifier(type_name_, true); - if (type_identifier) - { - type_object = TypeObjectFactory::get_instance()->get_type_object(type_name_, true); - } + // Get type information + const auto type_info = info.info.type_information().type_information; + on_type_discovery_(participant, type_info); +} - // If complete not found, try with minimal - if (!type_object) +void DynTypesParticipant::on_type_discovery_( + fastdds::dds::DomainParticipant* participant, + const fastdds::dds::xtypes::TypeInformation& type_info) +{ + // Get type information + fastdds::dds::xtypes::TypeObject dyn_type_object; + if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( + type_info.complete().typeid_with_size().type_id(), + dyn_type_object)) { - type_identifier = TypeObjectFactory::get_instance()->get_type_identifier(type_name_, false); - if (type_identifier) - { - type_object = TypeObjectFactory::get_instance()->get_type_object(type_name_, false); - } + // Error + return; } - // Build dynamic type if type identifier and object found in factory - if (type_identifier && type_object) - { - dynamic_type = TypeObjectFactory::get_instance()->build_dynamic_type(type_name_, type_identifier, type_object); - } + // Register discovered type + fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( + dyn_type_object)->build(); // Request type object through TypeLookup if not present in factory, or if type building failed - if (!dynamic_type) + if (!dyn_type) { - std::function callback( - [this] - (const std::string& /* type_name */, const DynamicType_ptr type) - { - this->internal_notify_type_object_(type); - }); - // Registering type and creating reader - participant->register_remote_type( - type_information, - type_name_, - callback); + //TODO: Return logWarning } else { - internal_notify_type_object_(dynamic_type); + internal_notify_type_object_(dyn_type); } } void DynTypesParticipant::internal_notify_type_object_( - DynamicType_ptr dynamic_type) + fastdds::dds::DynamicType::_ref_type dynamic_type) { logInfo(DDSPIPE_DYNTYPES_PARTICIPANT, "Participant " << this->id() << " discovered type object " << dynamic_type->get_name()); - monitor_type_discovered(dynamic_type->get_name()); + monitor_type_discovered((dynamic_type->get_name()).to_string()); // Create data containing Dynamic Type auto data = std::make_unique(); @@ -201,10 +179,6 @@ void DynTypesParticipant::initialize_internal_dds_participant_() configuration->app_metadata, "true"); - // Set Type LookUp to ON - pqos.wire_protocol().builtin.typelookup_config.use_server = false; - pqos.wire_protocol().builtin.typelookup_config.use_client = true; - // Configure Participant transports if (configuration->transport == core::types::TransportDescriptors::builtin) { diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp index 2a4fbbf4..a6522703 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -121,7 +122,7 @@ utils::ReturnCode BaseReader::take( { logDevError(DDSPIPE_BASEREADER, "Attempt to take data from disabled Reader in Participant " << participant_id_); - return utils::ReturnCode::RETCODE_NOT_ENABLED; + return utils::ReturnCode::NOT_ENABLED; } } diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp index 1f824b10..bedb2160 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include @@ -40,7 +41,7 @@ void BlankReader::unset_on_data_available_callback() noexcept utils::ReturnCode BlankReader::take( std::unique_ptr& /* data */) noexcept { - return utils::ReturnCode::RETCODE_NO_DATA; + return utils::ReturnCode::NO_DATA; } core::types::Guid BlankReader::guid() const diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp index b04a8a59..126bff98 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp @@ -18,6 +18,7 @@ #include #include +#include #include @@ -71,14 +72,14 @@ utils::ReturnCode InternalReader::take_nts_( // There is no data pending sent if (data_to_send_.empty()) { - return utils::ReturnCode::RETCODE_NO_DATA; + return utils::ReturnCode::NO_DATA; } // Move first data in queue to input data = std::move(data_to_send_.front()); data_to_send_.pop(); - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp index ae19b3a9..1d74d9ea 100644 --- a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp @@ -71,21 +71,12 @@ void CommonReader::init() // Create CommonReader // Listener must be set in creation as no callbacks should be missed // It is safe to do so here as object is already created and callbacks do not require anything set in this method - #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 12 - reader_ = dds_subscriber_->create_datareader_with_payload_pool( - dds_topic_, - reckon_reader_qos_(), - payload_pool_, - nullptr, - eprosima::fastdds::dds::StatusMask::all()); - #else reader_ = dds_subscriber_->create_datareader( dds_topic_, reckon_reader_qos_(), nullptr, eprosima::fastdds::dds::StatusMask::all(), payload_pool_); - #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 if (!reader_) { @@ -178,7 +169,7 @@ utils::ReturnCode CommonReader::take_nts_( // Check if there is data available if (!(reader_->get_unread_count() > 0)) { - return utils::ReturnCode::RETCODE_NO_DATA; + return utils::ReturnCode::NO_DATA; } std::unique_ptr rtps_data; @@ -206,7 +197,7 @@ utils::ReturnCode CommonReader::take_nts_( if (!rtps_data) { logError(DDSPIPE_DDS_READER, "The data taken by the reader is not valid."); - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } fill_received_data_(info, *rtps_data); @@ -214,7 +205,7 @@ utils::ReturnCode CommonReader::take_nts_( // data is a unique_ptr; the memory will be handled correctly. data.reset(rtps_data.release()); - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } void CommonReader::enable_nts_() noexcept diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index f7e24810..3551795a 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -161,7 +161,7 @@ utils::ReturnCode CommonReader::take_nts_( // Check if there is data available if (!(rtps_reader_->get_unread_count() > 0)) { - return utils::ReturnCode::RETCODE_NO_DATA; + return utils::ReturnCode::NO_DATA; } fastrtps::rtps::CacheChange_t* received_change = nullptr; @@ -171,12 +171,12 @@ utils::ReturnCode CommonReader::take_nts_( if (!rtps_reader_->nextUntakenCache(&received_change, &wp)) { // Error reading. - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } // If data received is not correct, discard it and remove it from history auto ret = is_data_correct_(received_change); - if (!ret) + if (ret != utils::ReturnCode::OK) { // Remove the change in the History and release it in the reader rtps_reader_->getHistory()->remove_change(received_change); @@ -191,7 +191,7 @@ utils::ReturnCode CommonReader::take_nts_( // Remove the change in the History and release it in the reader rtps_reader_->getHistory()->remove_change(received_change); - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } RtpsPayloadData* CommonReader::create_data_( @@ -517,7 +517,7 @@ utils::ReturnCode CommonReader::is_data_correct_( logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data without correct writer GUID."); - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } // Check that the data is consistent @@ -529,11 +529,11 @@ utils::ReturnCode CommonReader::is_data_correct_( logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data with length " << received_change->serializedPayload.length << "."); - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } } /* namespace rtps */ diff --git a/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp b/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp index 6340c685..660f9ad9 100644 --- a/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp +++ b/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp @@ -143,13 +143,13 @@ utils::ReturnCode MockReader::take_nts_( if (data_queue_.empty()) { - return utils::ReturnCode::RETCODE_NO_DATA; + return utils::ReturnCode::NO_DATA; } data.reset(new MockRoutingData(std::move(data_queue_.front()))); data_queue_.pop(); - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } void MockReader::enable_nts_() noexcept @@ -181,7 +181,7 @@ utils::ReturnCode MockWriter::write_nts_( } ++waiter_; - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } MockRoutingData MockWriter::wait_data() diff --git a/ddspipe_participants/src/cpp/types/address/Address.cpp b/ddspipe_participants/src/cpp/types/address/Address.cpp index f7e0e774..db016d0f 100644 --- a/ddspipe_participants/src/cpp/types/address/Address.cpp +++ b/ddspipe_participants/src/cpp/types/address/Address.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index d5f53e6e..81385727 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -37,7 +37,6 @@ TopicDataType::TopicDataType( // Set topic data m_typeSize = 4; m_isGetKeyDefined = keyed_; - auto_fill_type_object(false); auto_fill_type_information(false); // Set name diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp index 842dfb0e..0817fb9d 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp @@ -13,6 +13,8 @@ // limitations under the License. #include +#include + #include #include @@ -75,7 +77,7 @@ utils::ReturnCode BaseWriter::write( { if (!should_send_sample_()) { - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } else { @@ -87,7 +89,7 @@ utils::ReturnCode BaseWriter::write( { logDevError(DDSPIPE_BASEWRITER, "Attempt to write data from disabled Writer in topic in Participant " << participant_id_); - return utils::ReturnCode::RETCODE_NOT_ENABLED; + return utils::ReturnCode::NOT_ENABLED; } } diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp index e9e11a44..9ae12217 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp @@ -30,7 +30,7 @@ void BlankWriter::disable() noexcept utils::ReturnCode BlankWriter::write( core::IRoutingData& /* data */) noexcept { - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp index a1e6480f..ab937bf0 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp @@ -62,7 +62,7 @@ utils::ReturnCode RtpsEchoWriter::write( "."); } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index bfb4d46b..14546666 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -69,21 +69,12 @@ void CommonWriter::init() participant_id_ << " in topic " << topic_ << "."); } - #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 12 - writer_ = dds_publisher_->create_datawriter_with_payload_pool( - dds_topic_, - reckon_writer_qos_(), - payload_pool_, - nullptr, - eprosima::fastdds::dds::StatusMask::all()); - #else writer_ = dds_publisher_->create_datawriter( dds_topic_, reckon_writer_qos_(), nullptr, eprosima::fastdds::dds::StatusMask::all(), payload_pool_); - #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 if (!writer_) { @@ -127,11 +118,11 @@ utils::ReturnCode CommonWriter::write_nts_( { if (payload_pool_->write(writer_, &rtps_data)) { - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } else { - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } } } diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp index 4c09e45c..239c3c99 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp @@ -65,10 +65,10 @@ utils::ReturnCode SchemaWriter::write_nts_( logWarning( DDSPIPE_SCHEMA_WRITER, "Error writting data in topic " << topic_ << " : <" << e.what() << ">."); - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp index aceaa1eb..03bdadf7 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp @@ -18,8 +18,7 @@ #include -#include -#include +#include #include #include @@ -60,10 +59,10 @@ utils::ReturnCode TypeObjectWriter::write_nts_( DDSPIPE_TYPEOBJECT_WRITER, "Error generating schema for type " << dynamic_type_data.dynamic_type->get_name() << " : <" << e.what() << ">."); - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index c41c4322..4ad6c949 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -66,7 +66,7 @@ utils::ReturnCode SimpleWriter::fill_to_send_data_( to_send_params.related_sample_identity(rpc_data.write_params.get_reference().related_sample_identity()); } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } void SimpleWriter::fill_sent_data_( diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 31cc609d..34ec0541 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -182,7 +182,7 @@ utils::ReturnCode CommonWriter::write_nts_( // If still is not able to get a change, return an error code if (!new_change) { - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } logDebug(DDSPIPE_RTPS_COMMONWRITER, @@ -194,7 +194,7 @@ utils::ReturnCode CommonWriter::write_nts_( // Fill cache change with specific data to send auto ret = fill_to_send_data_(new_change, write_params, rtps_data); - if (!ret) + if (ret != utils::ReturnCode::OK) { logError(DDSPIPE_RTPS_COMMONWRITER, "Error setting change to send."); return ret; @@ -208,7 +208,7 @@ utils::ReturnCode CommonWriter::write_nts_( // At this point, write params is now the output of adding change fill_sent_data_(write_params, rtps_data); - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } utils::ReturnCode CommonWriter::fill_to_send_data_( @@ -240,7 +240,7 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( (*to_send_change_to_fill))) { logDevError(DDSPIPE_RTPS_COMMONWRITER, "Error getting Payload."); - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } } @@ -250,7 +250,7 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( // Set source time stamp to be the original one to_send_params.source_timestamp(data.source_timestamp); - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } void CommonWriter::fill_sent_data_( diff --git a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp index 450d47b9..f2678b0a 100644 --- a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp +++ b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp @@ -14,7 +14,9 @@ #include -#include +// #include +#include +#include #include @@ -26,34 +28,38 @@ utils::ReturnCode XmlHandler::load_xml( const XmlHandlerConfiguration& configuration) { // Load default xml profiles - // Note: we assume this function cannot fail - fastrtps::xmlparser::XMLProfileManager::loadDefaultXMLFile(); + fastdds::dds::ReturnCode_t ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_profiles(); + + if (ret != fastdds::dds::RETCODE_OK) + { + return utils::ReturnCode::ERROR; + } // Load string if exist if (configuration.raw.is_set()) { - fastrtps::xmlparser::XMLP_ret res = fastrtps::xmlparser::XMLProfileManager::loadXMLString( + fastdds::dds::ReturnCode_t ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_string( configuration.raw->c_str(), configuration.raw->size()); - if (res != fastrtps::xmlparser::XMLP_ret::XML_OK) + if (ret != fastdds::dds::RETCODE_OK) { - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } } // Load files for (const auto& file : configuration.files) { - fastrtps::xmlparser::XMLP_ret res = fastrtps::xmlparser::XMLProfileManager::loadXMLFile(file); + fastdds::dds::ReturnCode_t ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_file(file); - if (res != fastrtps::xmlparser::XMLP_ret::XML_OK) + if (ret != fastdds::dds::RETCODE_OK) { - return utils::ReturnCode::RETCODE_ERROR; + return utils::ReturnCode::ERROR; } } - return utils::ReturnCode::RETCODE_OK; + return utils::ReturnCode::OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp b/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp index aa683e6a..79f65f6f 100644 --- a/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp +++ b/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp @@ -15,7 +15,7 @@ #include #include -#include +// #include #include diff --git a/ddspipe_yaml/package.xml b/ddspipe_yaml/package.xml index 39838b53..5b8b670d 100644 --- a/ddspipe_yaml/package.xml +++ b/ddspipe_yaml/package.xml @@ -18,7 +18,7 @@ cmake_utils yamlcpp - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/project_settings.cmake b/ddspipe_yaml/project_settings.cmake index 0c290e84..12ff026c 100644 --- a/ddspipe_yaml/project_settings.cmake +++ b/ddspipe_yaml/project_settings.cmake @@ -27,7 +27,7 @@ set(MODULE_SUMMARY set(MODULE_FIND_PACKAGES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/entities/address/CMakeLists.txt b/ddspipe_yaml/test/unittest/entities/address/CMakeLists.txt index 143b72bb..9983c0c1 100644 --- a/ddspipe_yaml/test/unittest/entities/address/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/entities/address/CMakeLists.txt @@ -39,7 +39,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants @@ -72,7 +72,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/entities/guid/CMakeLists.txt b/ddspipe_yaml/test/unittest/entities/guid/CMakeLists.txt index e67669ec..605db8fc 100644 --- a/ddspipe_yaml/test/unittest/entities/guid/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/entities/guid/CMakeLists.txt @@ -36,7 +36,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/entities/topic/CMakeLists.txt b/ddspipe_yaml/test/unittest/entities/topic/CMakeLists.txt index cf536cc3..373cdba5 100644 --- a/ddspipe_yaml/test/unittest/entities/topic/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/entities/topic/CMakeLists.txt @@ -38,7 +38,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/entities/transport/CMakeLists.txt b/ddspipe_yaml/test/unittest/entities/transport/CMakeLists.txt index 2e3f25e9..a54dc70c 100644 --- a/ddspipe_yaml/test/unittest/entities/transport/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/entities/transport/CMakeLists.txt @@ -36,7 +36,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants @@ -73,7 +73,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/routes/CMakeLists.txt b/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/routes/CMakeLists.txt index ea1970cd..fd12f1f5 100644 --- a/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/routes/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/routes/CMakeLists.txt @@ -37,7 +37,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/topic_routes/CMakeLists.txt b/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/topic_routes/CMakeLists.txt index a32d1a3b..6f1733e7 100644 --- a/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/topic_routes/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/yaml_reader/forwarding_routes/topic_routes/CMakeLists.txt @@ -36,7 +36,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/yaml_reader/log_configuration/CMakeLists.txt b/ddspipe_yaml/test/unittest/yaml_reader/log_configuration/CMakeLists.txt index 9c7ce189..0840be99 100644 --- a/ddspipe_yaml/test/unittest/yaml_reader/log_configuration/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/yaml_reader/log_configuration/CMakeLists.txt @@ -33,7 +33,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_yaml diff --git a/ddspipe_yaml/test/unittest/yaml_reader/monitoring/CMakeLists.txt b/ddspipe_yaml/test/unittest/yaml_reader/monitoring/CMakeLists.txt index 60dfaec0..e38c635c 100644 --- a/ddspipe_yaml/test/unittest/yaml_reader/monitoring/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/yaml_reader/monitoring/CMakeLists.txt @@ -35,7 +35,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/yaml_reader/scalar/CMakeLists.txt b/ddspipe_yaml/test/unittest/yaml_reader/scalar/CMakeLists.txt index 8c07047b..31c9731c 100644 --- a/ddspipe_yaml/test/unittest/yaml_reader/scalar/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/yaml_reader/scalar/CMakeLists.txt @@ -37,7 +37,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt b/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt index 700c4396..b245030b 100644 --- a/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt +++ b/ddspipe_yaml/test/unittest/yaml_writer/CMakeLists.txt @@ -41,7 +41,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants @@ -75,7 +75,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants From fb76564306b6bc7da9d46d0ba5902ddea19e6f34 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Sat, 27 Apr 2024 12:39:07 +0200 Subject: [PATCH 02/53] Fix tests and first approximation to change Dynamic Types Signed-off-by: Lucia Echevarria --- .../types/dynamic_types/types.hpp | 3 ++ .../cpp/types/dynamic_types/schema_idl.cpp | 12 +++--- .../cpp/types/dynamic_types/schema_msg.cpp | 6 +-- .../src/cpp/types/dynamic_types/types.cpp | 2 +- .../test/unittest/core/ddspipe/CMakeLists.txt | 7 ---- .../logging/dds_consumer/CMakeLists.txt | 7 ---- .../logging/std_consumer/CMakeLists.txt | 7 ---- .../monitoring/status/dds/CMakeLists.txt | 7 ---- .../monitoring/status/logging/CMakeLists.txt | 7 ---- .../monitoring/topics/dds/CMakeLists.txt | 7 ---- .../monitoring/topics/logging/CMakeLists.txt | 7 ---- .../types/dynamic_types/types/all_types.hpp | 21 +++++++--- .../dynamic_types/DynTypesParticipant.hpp | 3 +- .../dynamic_types/DynTypesParticipant.cpp | 40 ++++++++++++++----- 14 files changed, 61 insertions(+), 75 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp index 5ac15468..ae856d01 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp @@ -15,6 +15,7 @@ #pragma once #include +#include #include #include @@ -36,6 +37,8 @@ struct DynamicTypeData : public core::IRoutingData virtual types::TopicInternalTypeDiscriminator internal_type_discriminator() const noexcept override; fastdds::dds::DynamicType::_ref_type dynamic_type{nullptr}; + + // fastdds::dds::xtypes::TypeInformation type_information{}; }; DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp index 13294180..e799d6ee 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp @@ -71,7 +71,7 @@ std::string type_kind_to_str( fastdds::dds::DynamicType::_ref_type container_internal_type( const fastdds::dds::DynamicType::_ref_type& dyn_type) { - fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { @@ -83,7 +83,7 @@ fastdds::dds::DynamicType::_ref_type container_internal_type( std::vector container_size( const fastdds::dds::DynamicType::_ref_type& dyn_type) { - fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { @@ -103,7 +103,7 @@ std::vector> get_me for (const auto& member : members) { fastdds::dds::ObjectName dyn_name = member.second->get_name(); - fastdds::dds::MemberDescriptor::_ref_type member_descriptor; + fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = member.second->get_descriptor(member_descriptor); if (ret != fastdds::dds::RETCODE_OK) { @@ -159,7 +159,7 @@ std::string map_kind_to_str( const fastdds::dds::DynamicType::_ref_type& dyn_type) { std::stringstream ss; - fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { @@ -369,7 +369,7 @@ std::ostream& union_to_str( std::ostream& os, const utils::TreeNode& node) { - fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = node.info.dynamic_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { @@ -382,7 +382,7 @@ std::ostream& union_to_str( node.info.dynamic_type->get_all_members(members); // WARNING: Default case not included in this collection, and currently not available for (const auto& member : members) { - fastdds::dds::MemberDescriptor::_ref_type member_descriptor; + fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = member.second->get_descriptor(member_descriptor); if (ret != fastdds::dds::RETCODE_OK) { diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index a483718e..5795b073 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -66,7 +66,7 @@ std::string type_kind_to_str( fastdds::dds::DynamicType::_ref_type container_internal_type( const fastdds::dds::DynamicType::_ref_type& dyn_type) { - fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { @@ -78,7 +78,7 @@ fastdds::dds::DynamicType::_ref_type container_internal_type( std::vector array_size( const fastdds::dds::DynamicType::_ref_type& dyn_type) { - fastdds::dds::TypeDescriptor::_ref_type type_descriptor; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { @@ -98,7 +98,7 @@ std::vector> get_me for (const auto& member : members) { fastdds::dds::ObjectName dyn_name = member.second->get_name(); - fastdds::dds::MemberDescriptor::_ref_type member_descriptor; + fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; const auto ret = member.second->get_descriptor(member_descriptor); if (ret != fastdds::dds::RETCODE_OK) { diff --git a/ddspipe_core/src/cpp/types/dynamic_types/types.cpp b/ddspipe_core/src/cpp/types/dynamic_types/types.cpp index 048514e0..0361b876 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/types.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/types.cpp @@ -16,7 +16,7 @@ * @file types.cpp */ -#include +#include #include diff --git a/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt b/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt index fc80a4f8..623e1614 100644 --- a/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt +++ b/ddspipe_core/test/unittest/core/ddspipe/CMakeLists.txt @@ -25,13 +25,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.ipp" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") -else() - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") -endif() - all_library_sources( "${TEST_SOURCES}" "${LIBRARY_SOURCES}" diff --git a/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt b/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt index 6e99dbd4..7430c5a0 100644 --- a/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt +++ b/ddspipe_core/test/unittest/logging/dds_consumer/CMakeLists.txt @@ -25,13 +25,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.ipp" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") -else() - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") -endif() - all_library_sources( "${TEST_SOURCES}" "${LIBRARY_SOURCES}" diff --git a/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt b/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt index f765c238..b5670c9b 100644 --- a/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt +++ b/ddspipe_core/test/unittest/logging/std_consumer/CMakeLists.txt @@ -25,13 +25,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.ipp" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") -else() - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") -endif() - all_library_sources( "${TEST_SOURCES}" "${LIBRARY_SOURCES}" diff --git a/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt index 330353dc..9ea87ac1 100644 --- a/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/status/dds/CMakeLists.txt @@ -25,13 +25,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.ipp" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") -else() - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") -endif() - all_library_sources( "${TEST_SOURCES}" "${LIBRARY_SOURCES}" diff --git a/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt index 904717a6..0ed515e1 100644 --- a/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/status/logging/CMakeLists.txt @@ -25,13 +25,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.ipp" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") -else() - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") -endif() - all_library_sources( "${TEST_SOURCES}" "${LIBRARY_SOURCES}" diff --git a/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt index defe40e0..92ad31f3 100644 --- a/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/topics/dds/CMakeLists.txt @@ -25,13 +25,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.ipp" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") -else() - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") -endif() - all_library_sources( "${TEST_SOURCES}" "${LIBRARY_SOURCES}" diff --git a/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt b/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt index b32d40fc..01839ffe 100644 --- a/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt +++ b/ddspipe_core/test/unittest/monitoring/topics/logging/CMakeLists.txt @@ -25,13 +25,6 @@ file( "${PROJECT_SOURCE_DIR}/include/*.ipp" ) -# Exclude types' files depending on the Fast DDS version -if ("${fastdds_VERSION}" VERSION_LESS 3.0.0) - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v2/") -else() - list(FILTER LIBRARY_SOURCES EXCLUDE REGEX "v1/") -endif() - all_library_sources( "${TEST_SOURCES}" "${LIBRARY_SOURCES}" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp index 4b143191..fe2e4e2b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp @@ -80,12 +80,23 @@ eprosima::fastdds::dds::DynamicType::_ref_type get_dynamic_type( // traitstype_object_registry().get_type_objects( - type_name, - type_objects); + fastdds::dds::xtypes::TypeInformation type_information; + if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( + type_name, + type_information)) + { + return nullptr; + } + fastdds::dds::xtypes::TypeIdentifier type_id; + type_id = type_information.complete().typeid_with_size().type_id(); + + fastdds::dds::xtypes::TypeObject type_obj; + if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( + type_id, + type_obj)) + } - if (ret != eprosima::fastdds::dds::RETCODE_OK) + else { throw eprosima::utils::InconsistencyException("No Type Object"); } diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 68d39a82..791d3e0e 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -90,7 +90,8 @@ class DynTypesParticipant : public rtps::SimpleParticipant, public eprosima::fas void on_type_discovery_( fastdds::dds::DomainParticipant* participant, - const fastdds::dds::xtypes::TypeInformation& type_info); + const fastdds::dds::xtypes::TypeInformation& type_info, + const std::string& type_name); void internal_notify_type_object_( fastdds::dds::DynamicType::_ref_type dynamic_type); diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 2c5ceaaf..e239b612 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -21,18 +21,18 @@ #include #include -#include -#include #include -// #include -#include -#include -#include #include #include -#include +#include +#include +#include +#include +#include +#include #include +#include #include #include #include @@ -102,7 +102,7 @@ void DynTypesParticipant::on_data_reader_discovery( { // Get type information const auto type_info = info.info.type_information().type_information; - on_type_discovery_(participant, type_info); + on_type_discovery_(participant, type_info, info.info.typeName().to_string()); } void DynTypesParticipant::on_data_writer_discovery( @@ -112,12 +112,13 @@ void DynTypesParticipant::on_data_writer_discovery( { // Get type information const auto type_info = info.info.type_information().type_information; - on_type_discovery_(participant, type_info); + on_type_discovery_(participant, type_info, info.info.typeName().to_string()); } void DynTypesParticipant::on_type_discovery_( fastdds::dds::DomainParticipant* participant, - const fastdds::dds::xtypes::TypeInformation& type_info) + const fastdds::dds::xtypes::TypeInformation& type_info, + const std::string& type_name) { // Get type information fastdds::dds::xtypes::TypeObject dyn_type_object; @@ -129,6 +130,24 @@ void DynTypesParticipant::on_type_discovery_( return; } + fastdds::dds::xtypes::TypeIdentifierSeq type_id_seq; + std::unordered_set type_dependencies; + if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_dependencies( + type_id_seq, + type_dependencies)) + { + return; + } + + // // Napa: reregister as local + // if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().register_type_object( + // type_name, + // dyn_type_object.complete())) + // { + // // Error + // return; + // } + // Register discovered type fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( dyn_type_object)->build(); @@ -155,6 +174,7 @@ void DynTypesParticipant::internal_notify_type_object_( // Create data containing Dynamic Type auto data = std::make_unique(); data->dynamic_type = dynamic_type; // TODO: add constructor with param + // data->type_information = type_information; // Insert new data in internal reader queue type_object_reader_->simulate_data_reception(std::move(data)); From 1881f1bcc1aff335b86dd4b961d99d7755882cd6 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Fri, 17 May 2024 11:01:45 +0200 Subject: [PATCH 03/53] Fix DynTypesParticipant::on_type_discovery_ callback to register type_name-type_id tuple and some other minor changes Signed-off-by: Lucia Echevarria --- .../dynamic/DiscoveryDatabase.hpp | 6 +- .../ddspipe_core/interface/IReader.hpp | 2 +- .../types/dynamic_types/types.hpp | 6 ++ .../src/cpp/dynamic/DiscoveryDatabase.cpp | 12 +-- .../dynamic_types/DynTypesParticipant.hpp | 5 +- .../dynamic_types/ISchemaHandler.hpp | 7 +- .../reader/rtps/CommonReader.hpp | 4 +- .../writer/rpc/SimpleWriter.hpp | 2 +- .../writer/rtps/SimpleWriter.hpp | 2 +- .../cpp/participant/dds/XmlParticipant.cpp | 21 ++--- .../dynamic_types/DynTypesParticipant.cpp | 80 ++++++++++++------- .../writer/dynamic_types/TypeObjectWriter.cpp | 2 +- 12 files changed, 92 insertions(+), 57 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp b/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp index 3aedc661..1218c441 100644 --- a/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp +++ b/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp @@ -23,11 +23,11 @@ #include #include -#include +#include +#include #include #include -#include #include namespace eprosima { @@ -263,7 +263,7 @@ class DiscoveryDatabase mutable std::mutex callbacks_mutex_; //! Queue storing database operations to be performed in a dedicated thread - fastrtps::DBQueue> entities_to_process_; + utils::event::DBQueue> entities_to_process_; //! Handle of thread dedicated to performing database operations std::thread queue_processing_thread_; diff --git a/ddspipe_core/include/ddspipe_core/interface/IReader.hpp b/ddspipe_core/include/ddspipe_core/interface/IReader.hpp index 71153ef9..7ab3023c 100644 --- a/ddspipe_core/include/ddspipe_core/interface/IReader.hpp +++ b/ddspipe_core/include/ddspipe_core/interface/IReader.hpp @@ -16,7 +16,7 @@ #include -#include +#include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp index ae856d01..15c92938 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp @@ -14,6 +14,10 @@ #pragma once +#include + +#include + #include #include @@ -38,6 +42,8 @@ struct DynamicTypeData : public core::IRoutingData fastdds::dds::DynamicType::_ref_type dynamic_type{nullptr}; + std::tuple type_ids_tuple{}; + // fastdds::dds::xtypes::TypeInformation type_information{}; }; diff --git a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp index 4f088085..67c0d6a6 100644 --- a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp +++ b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp @@ -308,7 +308,7 @@ void DiscoveryDatabase::queue_processing_thread_routine_() noexcept lock, [&] { - return !entities_to_process_.BothEmpty() || exit_.load(); + return !entities_to_process_.both_empty() || exit_.load(); }); if (exit_.load()) @@ -326,17 +326,17 @@ void DiscoveryDatabase::push_item_to_queue_( { { std::lock_guard lock(entities_to_process_cv_mutex_); - entities_to_process_.Push(item); + entities_to_process_.push(item); } entities_to_process_cv_.notify_one(); } void DiscoveryDatabase::process_queue_() noexcept { - entities_to_process_.Swap(); - while (!entities_to_process_.Empty()) + entities_to_process_.swap(); + while (!entities_to_process_.empty()) { - std::tuple queue_item = entities_to_process_.Front(); + std::tuple queue_item = entities_to_process_.front(); DatabaseOperation db_operation = std::get<0>(queue_item); Endpoint entity = std::get<1>(queue_item); try @@ -359,7 +359,7 @@ void DiscoveryDatabase::process_queue_() noexcept logDevError(DDSPIPE_DISCOVERY_DATABASE, "Error processing database operations queue:" << e.what() << "."); } - entities_to_process_.Pop(); + entities_to_process_.pop(); } } diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 791d3e0e..d933b6b1 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -91,10 +91,11 @@ class DynTypesParticipant : public rtps::SimpleParticipant, public eprosima::fas void on_type_discovery_( fastdds::dds::DomainParticipant* participant, const fastdds::dds::xtypes::TypeInformation& type_info, - const std::string& type_name); + const fastcdr::string_255& type_name); void internal_notify_type_object_( - fastdds::dds::DynamicType::_ref_type dynamic_type); + fastdds::dds::DynamicType::_ref_type dynamic_type, + const std::tuple& type_name_and_id); void initialize_internal_dds_participant_(); diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp index 136e46fe..cb9ddfd4 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp @@ -18,6 +18,10 @@ #pragma once +#include + +#include + #include #include @@ -35,7 +39,8 @@ class ISchemaHandler public: virtual void add_schema( - const fastdds::dds::DynamicType::_ref_type& dynamic_type) = 0; + const fastdds::dds::DynamicType::_ref_type& dynamic_type, + const std::tuple& type_ids_tuple) = 0; virtual void add_data( const core::types::DdsTopic& topic, diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index 081798cb..42304ece 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -21,13 +21,13 @@ #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp index 8f36c5ad..12d607d3 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp index c18f24e6..3d7997a6 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index 83967bc6..48bb350f 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -15,7 +15,9 @@ #include #include +#include #include +#include // #include #include @@ -39,15 +41,16 @@ XmlParticipant::XmlParticipant( : CommonParticipant(participant_configuration, payload_pool, discovery_database) , xml_specific_configuration_(*reinterpret_cast(configuration_.get())) { - // // Replace the configuration's domain with the XML's domainId - // eprosima::fastrtps::ParticipantAttributes attr; - - // if (xml_specific_configuration_.participant_profile.is_set() && - // XMLProfileManager::fillParticipantAttributes(xml_specific_configuration_.participant_profile - // .get_value(), attr) == XMLP_ret::XML_OK) - // { - // configuration_->domain = attr.domainId; - // } + if (xml_specific_configuration_.participant_profile.is_set()) + { + fastdds::dds::DomainParticipantExtendedQos extended_qos; + if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( + xml_specific_configuration_.participant_profile.get_value(), + extended_qos)) + { + configuration_->domain = extended_qos.domainId(); + } + } } std::shared_ptr XmlParticipant::create_writer( diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index e239b612..2ab38346 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -18,9 +18,13 @@ #include +#include +#include + #include #include +#include #include #include #include @@ -102,7 +106,8 @@ void DynTypesParticipant::on_data_reader_discovery( { // Get type information const auto type_info = info.info.type_information().type_information; - on_type_discovery_(participant, type_info, info.info.typeName().to_string()); + const auto type_name = info.info.typeName(); + on_type_discovery_(participant, type_info, type_name); } void DynTypesParticipant::on_data_writer_discovery( @@ -112,59 +117,74 @@ void DynTypesParticipant::on_data_writer_discovery( { // Get type information const auto type_info = info.info.type_information().type_information; - on_type_discovery_(participant, type_info, info.info.typeName().to_string()); + const auto type_name = info.info.typeName(); + on_type_discovery_(participant, type_info, type_name); } void DynTypesParticipant::on_type_discovery_( fastdds::dds::DomainParticipant* participant, const fastdds::dds::xtypes::TypeInformation& type_info, - const std::string& type_name) + const fastcdr::string_255& type_name) { - // Get type information + auto type_identifier = type_info.complete().typeid_with_size().type_id(); fastdds::dds::xtypes::TypeObject dyn_type_object; if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( - type_info.complete().typeid_with_size().type_id(), + type_identifier, dyn_type_object)) { // Error return; } - fastdds::dds::xtypes::TypeIdentifierSeq type_id_seq; - std::unordered_set type_dependencies; - if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_dependencies( - type_id_seq, - type_dependencies)) - { - return; - } - - // // Napa: reregister as local - // if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().register_type_object( - // type_name, - // dyn_type_object.complete())) - // { - // // Error - // return; - // } - - // Register discovered type + // TODO fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( - dyn_type_object)->build(); - - // Request type object through TypeLookup if not present in factory, or if type building failed + dyn_type_object)->build(); if (!dyn_type) { //TODO: Return logWarning } else { - internal_notify_type_object_(dyn_type); + fastdds::dds::TypeSupport dyn_type_support(new fastdds::dds::DynamicPubSubType(dyn_type)); + dyn_type_support.register_type(participant); + + // Save type_identifier and its associated tyme_name. NOTE: We assume each type_name corresponds to only one type_identifier + auto type_name_and_id = std::make_tuple(type_name, type_identifier); + internal_notify_type_object_(dyn_type, type_name_and_id); } + + // // Register its dependencies + // for (const auto& type_id : type_dependencies) + // { + // // Get type object + // fastdds::dds::xtypes::TypeObject dyn_type_object; + // if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( + // type_id.type_id(), + // dyn_type_object)) + // { + // // Error + // return; + // } + + // // Register discovered type + // fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( + // dyn_type_object)->build(); + + // // Request type object through TypeLookup if not present in factory, or if type building failed + // if (!dyn_type) + // { + // //TODO: Return logWarning + // } + // else + // { + // internal_notify_type_object_(dyn_type); + // } + // } } void DynTypesParticipant::internal_notify_type_object_( - fastdds::dds::DynamicType::_ref_type dynamic_type) + fastdds::dds::DynamicType::_ref_type dynamic_type, + const std::tuple& type_name_and_id) { logInfo(DDSPIPE_DYNTYPES_PARTICIPANT, "Participant " << this->id() << " discovered type object " << dynamic_type->get_name()); @@ -174,7 +194,7 @@ void DynTypesParticipant::internal_notify_type_object_( // Create data containing Dynamic Type auto data = std::make_unique(); data->dynamic_type = dynamic_type; // TODO: add constructor with param - // data->type_information = type_information; + data->type_ids_tuple = type_name_and_id; // Insert new data in internal reader queue type_object_reader_->simulate_data_reception(std::move(data)); diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp index 03bdadf7..30cc9a02 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp @@ -51,7 +51,7 @@ utils::ReturnCode TypeObjectWriter::write_nts_( // Add schema try { - schema_handler_->add_schema(dynamic_type_data.dynamic_type); + schema_handler_->add_schema(dynamic_type_data.dynamic_type, dynamic_type_data.type_ids_tuple); } catch (const utils::Exception& e) { From 48963568ef6b338fb92a5afffda45aedea0cc015 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 20 May 2024 15:14:20 +0200 Subject: [PATCH 04/53] Change DynTypesParticipant to use RTPS Participant callbacks Signed-off-by: Lucia Echevarria --- .../dynamic_types/DynTypesParticipant.hpp | 22 +-- .../dynamic_types/DynTypesParticipant.cpp | 183 ++---------------- 2 files changed, 27 insertions(+), 178 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index d933b6b1..4ce75f4e 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -39,7 +39,7 @@ namespace participants { * * TODO: separate these 2 participants */ -class DynTypesParticipant : public rtps::SimpleParticipant, public eprosima::fastdds::dds::DomainParticipantListener +class DynTypesParticipant : public rtps::SimpleParticipant { public: @@ -75,21 +75,19 @@ class DynTypesParticipant : public rtps::SimpleParticipant, public eprosima::fas const core::ITopic& topic) override; DDSPIPE_PARTICIPANTS_DllAPI - void on_data_reader_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info, - bool& /*should_be_ignored*/) override; + void onReaderDiscovery( + fastrtps::rtps::RTPSParticipant* participant, + fastrtps::rtps::ReaderDiscoveryInfo&& info) override; DDSPIPE_PARTICIPANTS_DllAPI - void on_data_writer_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info, - bool& /*should_be_ignored*/) override; + void onWriterDiscovery( + fastrtps::rtps::RTPSParticipant* participant, + fastrtps::rtps::WriterDiscoveryInfo&& info) override; protected: void on_type_discovery_( - fastdds::dds::DomainParticipant* participant, + fastrtps::rtps::RTPSParticipant* participant, const fastdds::dds::xtypes::TypeInformation& type_info, const fastcdr::string_255& type_name); @@ -97,10 +95,6 @@ class DynTypesParticipant : public rtps::SimpleParticipant, public eprosima::fas fastdds::dds::DynamicType::_ref_type dynamic_type, const std::tuple& type_name_and_id); - void initialize_internal_dds_participant_(); - - fastdds::dds::DomainParticipant* dds_participant_; - //! Type Object Internal Reader std::shared_ptr type_object_reader_; }; diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 2ab38346..43ed329f 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include #include @@ -68,15 +70,12 @@ DynTypesParticipant::DynTypesParticipant( DynTypesParticipant::~DynTypesParticipant() { - dds_participant_->set_listener(nullptr); - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(dds_participant_); - + // Do nothing } void DynTypesParticipant::init() { CommonParticipant::init(); - initialize_internal_dds_participant_(); } std::shared_ptr DynTypesParticipant::create_writer( @@ -99,30 +98,32 @@ std::shared_ptr DynTypesParticipant::create_reader( return rtps::SimpleParticipant::create_reader(topic); } -void DynTypesParticipant::on_data_reader_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info, - bool&) +void DynTypesParticipant::onReaderDiscovery( + fastrtps::rtps::RTPSParticipant* participant, + fastrtps::rtps::ReaderDiscoveryInfo&& info) { + fastrtps::rtps::ReaderProxyData proxy_copy(info.info); // Get type information - const auto type_info = info.info.type_information().type_information; - const auto type_name = info.info.typeName(); + const auto type_info = proxy_copy.type_information().type_information; + const auto type_name = proxy_copy.typeName(); + rtps::CommonParticipant::onReaderDiscovery(participant, std::move(info)); on_type_discovery_(participant, type_info, type_name); } -void DynTypesParticipant::on_data_writer_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info, - bool&) +void DynTypesParticipant::onWriterDiscovery( + fastrtps::rtps::RTPSParticipant* participant, + fastrtps::rtps::WriterDiscoveryInfo&& info) { + fastrtps::rtps::WriterProxyData proxy_copy(info.info); // Get type information - const auto type_info = info.info.type_information().type_information; - const auto type_name = info.info.typeName(); + const auto type_info = proxy_copy.type_information().type_information; + const auto type_name = proxy_copy.typeName(); + rtps::CommonParticipant::onWriterDiscovery(participant, std::move(info)); on_type_discovery_(participant, type_info, type_name); } void DynTypesParticipant::on_type_discovery_( - fastdds::dds::DomainParticipant* participant, + fastrtps::rtps::RTPSParticipant* participant, const fastdds::dds::xtypes::TypeInformation& type_info, const fastcdr::string_255& type_name) { @@ -132,7 +133,6 @@ void DynTypesParticipant::on_type_discovery_( type_identifier, dyn_type_object)) { - // Error return; } @@ -141,45 +141,14 @@ void DynTypesParticipant::on_type_discovery_( dyn_type_object)->build(); if (!dyn_type) { - //TODO: Return logWarning + return; } else { - fastdds::dds::TypeSupport dyn_type_support(new fastdds::dds::DynamicPubSubType(dyn_type)); - dyn_type_support.register_type(participant); - // Save type_identifier and its associated tyme_name. NOTE: We assume each type_name corresponds to only one type_identifier auto type_name_and_id = std::make_tuple(type_name, type_identifier); internal_notify_type_object_(dyn_type, type_name_and_id); } - - // // Register its dependencies - // for (const auto& type_id : type_dependencies) - // { - // // Get type object - // fastdds::dds::xtypes::TypeObject dyn_type_object; - // if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( - // type_id.type_id(), - // dyn_type_object)) - // { - // // Error - // return; - // } - - // // Register discovered type - // fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( - // dyn_type_object)->build(); - - // // Request type object through TypeLookup if not present in factory, or if type building failed - // if (!dyn_type) - // { - // //TODO: Return logWarning - // } - // else - // { - // internal_notify_type_object_(dyn_type); - // } - // } } void DynTypesParticipant::internal_notify_type_object_( @@ -200,120 +169,6 @@ void DynTypesParticipant::internal_notify_type_object_( type_object_reader_->simulate_data_reception(std::move(data)); } -void DynTypesParticipant::initialize_internal_dds_participant_() -{ - - std::shared_ptr configuration = - std::dynamic_pointer_cast(this->configuration_); - - eprosima::fastdds::dds::DomainParticipantQos pqos; - pqos.name(this->id()); - - // Set app properties - pqos.properties().properties().emplace_back( - "fastdds.application.id", - configuration->app_id, - "true"); - pqos.properties().properties().emplace_back( - "fastdds.application.metadata", - configuration->app_metadata, - "true"); - - // Configure Participant transports - if (configuration->transport == core::types::TransportDescriptors::builtin) - { - if (!configuration->whitelist.empty()) - { - pqos.transport().use_builtin_transports = false; - - std::shared_ptr shm_transport = - std::make_shared(); - pqos.transport().user_transports.push_back(shm_transport); - - std::shared_ptr udp_transport = - create_descriptor(configuration->whitelist); - pqos.transport().user_transports.push_back(udp_transport); - } - } - else if (configuration->transport == core::types::TransportDescriptors::shm_only) - { - pqos.transport().use_builtin_transports = false; - - std::shared_ptr shm_transport = - std::make_shared(); - pqos.transport().user_transports.push_back(shm_transport); - } - else if (configuration->transport == core::types::TransportDescriptors::udp_only) - { - pqos.transport().use_builtin_transports = false; - - std::shared_ptr udp_transport = - create_descriptor(configuration->whitelist); - pqos.transport().user_transports.push_back(udp_transport); - } - - // Participant discovery filter configuration - switch (configuration->ignore_participant_flags) - { - case core::types::IgnoreParticipantFlags::no_filter: - pqos.wire_protocol().builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::NO_FILTER; - break; - case core::types::IgnoreParticipantFlags::filter_different_host: - pqos.wire_protocol().builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_HOST; - break; - case core::types::IgnoreParticipantFlags::filter_different_process: - pqos.wire_protocol().builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_PROCESS; - break; - case core::types::IgnoreParticipantFlags::filter_same_process: - pqos.wire_protocol().builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_SAME_PROCESS; - break; - case core::types::IgnoreParticipantFlags::filter_different_and_same_process: - pqos.wire_protocol().builtin.discovery_config.ignoreParticipantFlags = - static_cast( - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_PROCESS | - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_SAME_PROCESS); - break; - default: - break; - } - - // Force DDS entities to be created disabled - // NOTE: this is very dangerous because we are modifying a global variable (and a not thread safe one) in a - // local function. - // However, this is required, otherwise we could fail in two points: - // - receive in this object, maybe in same thread a discovery callback, which could use this variable - // (e.g to check if the Participant called is this one) - // - lose a discovery callback - fastdds::dds::DomainParticipantFactoryQos fact_qos; - fact_qos.entity_factory().autoenable_created_entities = false; - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->set_qos( - fact_qos); - - // CREATE THE PARTICIPANT - dds_participant_ = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->create_participant( - configuration->domain, - pqos); - - dds_participant_->set_listener(this); - - dds_participant_->enable(); - - // Restore default DomainParticipantQoS (create enabled entities) after creating and enabling this participant - // WARNING: not thread safe at the moment of this writing, see note above. - fact_qos.entity_factory().autoenable_created_entities = true; - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->set_qos( - fact_qos); - - if (dds_participant_ == nullptr) - { - throw utils::InitializationException("Error creating DDS Participant."); - } -} - } /* namespace participants */ } /* namespace ddspipe */ } /* namespace eprosima */ From 719ab7d4ec31749e32dd951726dc943143f936b6 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 27 May 2024 08:43:14 +0200 Subject: [PATCH 05/53] Regenarate types Signed-off-by: Lucia Echevarria --- .../types/logging/LogEntryPubSubTypes.h | 2 +- .../logging/LogEntryTypeObjectSupport.hpp | 26 +- .../status/MonitoringStatusPubSubTypes.h | 4 +- .../MonitoringStatusTypeObjectSupport.hpp | 21 +- .../topics/MonitoringTopicsPubSubTypes.h | 6 +- .../MonitoringTopicsTypeObjectSupport.hpp | 28 +- .../src/cpp/logging/DdsLogConsumer.cpp | 2 +- .../cpp/types/logging/LogEntryPubSubTypes.cxx | 5 +- .../logging/LogEntryTypeObjectSupport.cxx | 602 ++--- .../status/MonitoringStatusPubSubTypes.cxx | 10 +- .../MonitoringStatusTypeObjectSupport.cxx | 512 ++-- .../topics/MonitoringTopicsPubSubTypes.cxx | 15 +- .../MonitoringTopicsTypeObjectSupport.cxx | 2406 ++++------------- .../types/dynamic_types/types/all_types.hpp | 14 +- .../cpp/participant/dds/XmlParticipant.cpp | 22 +- 15 files changed, 1074 insertions(+), 2601 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h index 3cb1f284..26fa1041 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h @@ -89,7 +89,7 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp index be3ea739..674f83ef 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,20 +35,32 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_LogEntry_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +/** + * @brief Register Kind related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_Kind_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register LogEntry related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_LogEntry_type_identifier(); +eProsima_user_DllExport void register_LogEntry_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h index 2bd9088f..86014bed 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h @@ -89,7 +89,7 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -180,7 +180,7 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp index 2207c3e2..5b511d90 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_MonitoringStatus_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,15 +42,25 @@ eProsima_user_DllExport void register_MonitoringStatus_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_MonitoringErrorStatus_type_identifier(); +eProsima_user_DllExport void register_MonitoringErrorStatus_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register MonitoringStatus related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_MonitoringStatus_type_identifier(); +eProsima_user_DllExport void register_MonitoringStatus_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h index 8d9fd95a..0a4b1aca 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h @@ -89,7 +89,7 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -180,7 +180,7 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -271,7 +271,7 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp index 12817394..add655a1 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_MonitoringTopics_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,22 +42,37 @@ eProsima_user_DllExport void register_MonitoringTopics_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_DdsTopicData_type_identifier(); +eProsima_user_DllExport void register_DdsTopicData_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register DdsTopic related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_DdsTopic_type_identifier(); +eProsima_user_DllExport void register_DdsTopic_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register MonitoringTopics related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_MonitoringTopics_type_identifier(); +eProsima_user_DllExport void register_MonitoringTopics_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp index 8266568c..c46c2cb0 100644 --- a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp +++ b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp @@ -58,7 +58,7 @@ DdsLogConsumer::DdsLogConsumer( if (configuration->publish.publish_type) { // Publish the type - register_LogEntry_type_objects(); + type->register_type_object_representation(); type->auto_fill_type_information(true); } diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx index 07af35a5..a769a800 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx @@ -219,9 +219,10 @@ bool LogEntryPubSubType::getKey( return true; } -void LogEntryPubSubType::register_type_object_representation() const +void LogEntryPubSubType::register_type_object_representation() { - register_LogEntry_type_objects(); + eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; + register_LogEntry_type_identifier(type_ids); } diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx index 8e3bd715..d0527c95 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx @@ -38,23 +38,70 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_LogEntry_type_objects() +void register_Kind_type_identifier( + TypeIdentifierPair& type_ids_Kind) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_LogEntry_type_identifier(); - - }); -} - -void register_LogEntry_type_identifier() + EnumTypeFlag enum_flags_Kind = 0; + BitBound bit_bound_Kind = 32; + CommonEnumeratedHeader common_Kind = TypeObjectUtils::build_common_enumerated_header(bit_bound_Kind); + QualifiedTypeName type_name_Kind = "Kind"; + eprosima::fastcdr::optional type_ann_builtin_Kind; + eprosima::fastcdr::optional ann_custom_Kind; + CompleteTypeDetail detail_Kind = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Kind, ann_custom_Kind, type_name_Kind.to_string()); + CompleteEnumeratedHeader header_Kind = TypeObjectUtils::build_complete_enumerated_header(common_Kind, detail_Kind); + CompleteEnumeratedLiteralSeq literal_seq_Kind; + { + EnumeratedLiteralFlag flags_Info = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Info = TypeObjectUtils::build_common_enumerated_literal(0, flags_Info); + eprosima::fastcdr::optional member_ann_builtin_Info; + ann_custom_Kind.reset(); + MemberName name_Info = "Info"; + CompleteMemberDetail detail_Info = TypeObjectUtils::build_complete_member_detail(name_Info, member_ann_builtin_Info, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Info = TypeObjectUtils::build_complete_enumerated_literal(common_Info, detail_Info); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Info); + } + { + EnumeratedLiteralFlag flags_Warning = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Warning = TypeObjectUtils::build_common_enumerated_literal(1, flags_Warning); + eprosima::fastcdr::optional member_ann_builtin_Warning; + ann_custom_Kind.reset(); + MemberName name_Warning = "Warning"; + CompleteMemberDetail detail_Warning = TypeObjectUtils::build_complete_member_detail(name_Warning, member_ann_builtin_Warning, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Warning = TypeObjectUtils::build_complete_enumerated_literal(common_Warning, detail_Warning); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Warning); + } + { + EnumeratedLiteralFlag flags_Error = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Error = TypeObjectUtils::build_common_enumerated_literal(2, flags_Error); + eprosima::fastcdr::optional member_ann_builtin_Error; + ann_custom_Kind.reset(); + MemberName name_Error = "Error"; + CompleteMemberDetail detail_Error = TypeObjectUtils::build_complete_member_detail(name_Error, member_ann_builtin_Error, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Error = TypeObjectUtils::build_complete_enumerated_literal(common_Error, detail_Error); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Error); + } + CompleteEnumeratedType enumerated_type_Kind = TypeObjectUtils::build_complete_enumerated_type(enum_flags_Kind, header_Kind, + literal_seq_Kind); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_Kind, type_name_Kind.to_string(), type_ids_Kind)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Kind already registered in TypeObjectRegistry for a different type."); + } +}// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_LogEntry_type_identifier( + TypeIdentifierPair& type_ids_LogEntry) { + + ReturnCode_t return_code_LogEntry {eprosima::fastdds::dds::RETCODE_OK}; + return_code_LogEntry = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "LogEntry", type_ids_LogEntry); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_LogEntry) { StructTypeFlag struct_flags_LogEntry = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_LogEntry; - TypeIdentifierPair type_ids_LogEntry; + static_cast(return_code_LogEntry); QualifiedTypeName type_name_LogEntry = "LogEntry"; eprosima::fastcdr::optional type_ann_builtin_LogEntry; eprosima::fastcdr::optional ann_custom_LogEntry; @@ -63,11 +110,13 @@ void register_LogEntry_type_identifier() header_LogEntry = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_LogEntry); CompleteStructMemberSeq member_seq_LogEntry; { - return_code_LogEntry = + TypeIdentifierPair type_ids_event; + ReturnCode_t return_code_event {eprosima::fastdds::dds::RETCODE_OK}; + return_code_event = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_LogEntry); + "_int32_t", type_ids_event); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_event) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "event Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -77,41 +126,43 @@ void register_LogEntry_type_identifier() false, false, true, false); CommonStructMember common_event; MemberId member_id_event = 0x00000000; - if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_event.type_identifier1()._d() || TK_NONE == type_ids_event.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_event.type_identifier1()._d() && + EK_COMPLETE == type_ids_event.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_event.type_identifier1()._d() && + EK_COMPLETE == type_ids_event.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_event.type_identifier1()._d() && + EK_COMPLETE == type_ids_event.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_event.type_identifier1()._d() && + EK_COMPLETE == type_ids_event.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_event.type_identifier1()._d() && + (EK_COMPLETE == type_ids_event.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_event.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_event.type_identifier1()._d() && + (EK_COMPLETE == type_ids_event.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_event.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_event = TypeObjectUtils::build_common_struct_member(member_id_event, member_flags_event, type_ids_LogEntry.type_identifier1()); + common_event = TypeObjectUtils::build_common_struct_member(member_id_event, + member_flags_event, type_ids_event.type_identifier1()); } - else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_event.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_event.type_identifier2()._d() && + EK_COMPLETE == type_ids_event.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_event.type_identifier2()._d() && + EK_COMPLETE == type_ids_event.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_event.type_identifier2()._d() && + EK_COMPLETE == type_ids_event.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_event.type_identifier2()._d() && + EK_COMPLETE == type_ids_event.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_event.type_identifier2()._d() && + (EK_COMPLETE == type_ids_event.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_event.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_event.type_identifier2()._d() && + (EK_COMPLETE == type_ids_event.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_event.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_event = TypeObjectUtils::build_common_struct_member(member_id_event, member_flags_event, type_ids_LogEntry.type_identifier2()); + common_event = TypeObjectUtils::build_common_struct_member(member_id_event, + member_flags_event, type_ids_event.type_identifier2()); } else { @@ -140,108 +191,57 @@ void register_LogEntry_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_event); } { - return_code_LogEntry = + TypeIdentifierPair type_ids_kind; + ReturnCode_t return_code_kind {eprosima::fastdds::dds::RETCODE_OK}; + return_code_kind = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "Kind", type_ids_LogEntry); + "Kind", type_ids_kind); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_kind) { - EnumTypeFlag enum_flags_Kind = 0; - BitBound bit_bound_Kind = 32; - CommonEnumeratedHeader common_Kind = TypeObjectUtils::build_common_enumerated_header(bit_bound_Kind); - QualifiedTypeName type_name_Kind = "Kind"; - eprosima::fastcdr::optional type_ann_builtin_Kind; - eprosima::fastcdr::optional ann_custom_Kind; - CompleteTypeDetail detail_Kind = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Kind, ann_custom_Kind, type_name_Kind.to_string()); - CompleteEnumeratedHeader header_Kind = TypeObjectUtils::build_complete_enumerated_header(common_Kind, detail_Kind); - CompleteEnumeratedLiteralSeq literal_seq_Kind; - { - EnumeratedLiteralFlag flags_Info = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_Info = TypeObjectUtils::build_common_enumerated_literal(0, flags_Info); - eprosima::fastcdr::optional member_ann_builtin_Info; - ann_custom_Kind.reset(); - MemberName name_Info = "Info"; - CompleteMemberDetail detail_Info = TypeObjectUtils::build_complete_member_detail(name_Info, member_ann_builtin_Info, ann_custom_Kind); - CompleteEnumeratedLiteral literal_Info = TypeObjectUtils::build_complete_enumerated_literal(common_Info, detail_Info); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Info); - } - { - EnumeratedLiteralFlag flags_Warning = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_Warning = TypeObjectUtils::build_common_enumerated_literal(1, flags_Warning); - eprosima::fastcdr::optional member_ann_builtin_Warning; - ann_custom_Kind.reset(); - MemberName name_Warning = "Warning"; - CompleteMemberDetail detail_Warning = TypeObjectUtils::build_complete_member_detail(name_Warning, member_ann_builtin_Warning, ann_custom_Kind); - CompleteEnumeratedLiteral literal_Warning = TypeObjectUtils::build_complete_enumerated_literal(common_Warning, detail_Warning); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Warning); - } - { - EnumeratedLiteralFlag flags_Error = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_Error = TypeObjectUtils::build_common_enumerated_literal(2, flags_Error); - eprosima::fastcdr::optional member_ann_builtin_Error; - ann_custom_Kind.reset(); - MemberName name_Error = "Error"; - CompleteMemberDetail detail_Error = TypeObjectUtils::build_complete_member_detail(name_Error, member_ann_builtin_Error, ann_custom_Kind); - CompleteEnumeratedLiteral literal_Error = TypeObjectUtils::build_complete_enumerated_literal(common_Error, detail_Error); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Error); - } - CompleteEnumeratedType enumerated_type_Kind = TypeObjectUtils::build_complete_enumerated_type(enum_flags_Kind, header_Kind, - literal_seq_Kind); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_Kind, type_name_Kind.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Kind already registered in TypeObjectRegistry for a different type."); - } - return_code_LogEntry = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "Kind", type_ids_LogEntry); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Kind: Given Enum TypeIdentifier unknown to TypeObjectRegistry."); - return; - } + ::register_Kind_type_identifier(type_ids_kind); } StructMemberFlag member_flags_kind = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_kind; MemberId member_id_kind = 0x00000001; - if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_kind.type_identifier1()._d() || TK_NONE == type_ids_kind.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_kind.type_identifier1()._d() && + EK_COMPLETE == type_ids_kind.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_kind.type_identifier1()._d() && + EK_COMPLETE == type_ids_kind.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_kind.type_identifier1()._d() && + EK_COMPLETE == type_ids_kind.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_kind.type_identifier1()._d() && + EK_COMPLETE == type_ids_kind.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_kind.type_identifier1()._d() && + (EK_COMPLETE == type_ids_kind.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_kind.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_kind.type_identifier1()._d() && + (EK_COMPLETE == type_ids_kind.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_kind.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, member_flags_kind, type_ids_LogEntry.type_identifier1()); + common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, + member_flags_kind, type_ids_kind.type_identifier1()); } - else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_kind.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_kind.type_identifier2()._d() && + EK_COMPLETE == type_ids_kind.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_kind.type_identifier2()._d() && + EK_COMPLETE == type_ids_kind.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_kind.type_identifier2()._d() && + EK_COMPLETE == type_ids_kind.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_kind.type_identifier2()._d() && + EK_COMPLETE == type_ids_kind.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_kind.type_identifier2()._d() && + (EK_COMPLETE == type_ids_kind.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_kind.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_kind.type_identifier2()._d() && + (EK_COMPLETE == type_ids_kind.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_kind.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, member_flags_kind, type_ids_LogEntry.type_identifier2()); + common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, + member_flags_kind, type_ids_kind.type_identifier2()); } else { @@ -257,92 +257,67 @@ void register_LogEntry_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_kind); } { - return_code_LogEntry = + TypeIdentifierPair type_ids_category; + ReturnCode_t return_code_category {eprosima::fastdds::dds::RETCODE_OK}; + return_code_category = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_LogEntry); + "anonymous_string_unbounded", type_ids_category); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_category) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_category)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_LogEntry = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_LogEntry); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_category = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_category; MemberId member_id_category = 0x00000002; - if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_category.type_identifier1()._d() || TK_NONE == type_ids_category.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_category.type_identifier1()._d() && + EK_COMPLETE == type_ids_category.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_category.type_identifier1()._d() && + EK_COMPLETE == type_ids_category.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_category.type_identifier1()._d() && + EK_COMPLETE == type_ids_category.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_category.type_identifier1()._d() && + EK_COMPLETE == type_ids_category.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_category.type_identifier1()._d() && + (EK_COMPLETE == type_ids_category.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_category.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_category.type_identifier1()._d() && + (EK_COMPLETE == type_ids_category.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_category.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_category = TypeObjectUtils::build_common_struct_member(member_id_category, member_flags_category, type_ids_LogEntry.type_identifier1()); + common_category = TypeObjectUtils::build_common_struct_member(member_id_category, + member_flags_category, type_ids_category.type_identifier1()); } - else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_category.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_category.type_identifier2()._d() && + EK_COMPLETE == type_ids_category.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_category.type_identifier2()._d() && + EK_COMPLETE == type_ids_category.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_category.type_identifier2()._d() && + EK_COMPLETE == type_ids_category.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_category.type_identifier2()._d() && + EK_COMPLETE == type_ids_category.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_category.type_identifier2()._d() && + (EK_COMPLETE == type_ids_category.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_category.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_category.type_identifier2()._d() && + (EK_COMPLETE == type_ids_category.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_category.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_category = TypeObjectUtils::build_common_struct_member(member_id_category, member_flags_category, type_ids_LogEntry.type_identifier2()); + common_category = TypeObjectUtils::build_common_struct_member(member_id_category, + member_flags_category, type_ids_category.type_identifier2()); } else { @@ -358,92 +333,67 @@ void register_LogEntry_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_category); } { - return_code_LogEntry = + TypeIdentifierPair type_ids_message; + ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK}; + return_code_message = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_LogEntry); + "anonymous_string_unbounded", type_ids_message); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_message)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_LogEntry = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_LogEntry); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_message; MemberId member_id_message = 0x00000003; - if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_message.type_identifier1()._d() || TK_NONE == type_ids_message.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_message.type_identifier1()._d() && + EK_COMPLETE == type_ids_message.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_message.type_identifier1()._d() && + EK_COMPLETE == type_ids_message.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_message.type_identifier1()._d() && + EK_COMPLETE == type_ids_message.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_message.type_identifier1()._d() && + EK_COMPLETE == type_ids_message.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_message.type_identifier1()._d() && + (EK_COMPLETE == type_ids_message.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_message.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_message.type_identifier1()._d() && + (EK_COMPLETE == type_ids_message.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_message.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_LogEntry.type_identifier1()); + common_message = TypeObjectUtils::build_common_struct_member(member_id_message, + member_flags_message, type_ids_message.type_identifier1()); } - else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_message.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_message.type_identifier2()._d() && + EK_COMPLETE == type_ids_message.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_message.type_identifier2()._d() && + EK_COMPLETE == type_ids_message.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_message.type_identifier2()._d() && + EK_COMPLETE == type_ids_message.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_message.type_identifier2()._d() && + EK_COMPLETE == type_ids_message.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_message.type_identifier2()._d() && + (EK_COMPLETE == type_ids_message.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_message.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_message.type_identifier2()._d() && + (EK_COMPLETE == type_ids_message.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_message.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_LogEntry.type_identifier2()); + common_message = TypeObjectUtils::build_common_struct_member(member_id_message, + member_flags_message, type_ids_message.type_identifier2()); } else { @@ -459,92 +409,67 @@ void register_LogEntry_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_LogEntry, member_message); } { - return_code_LogEntry = + TypeIdentifierPair type_ids_timestamp; + ReturnCode_t return_code_timestamp {eprosima::fastdds::dds::RETCODE_OK}; + return_code_timestamp = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_LogEntry); + "anonymous_string_unbounded", type_ids_timestamp); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_timestamp) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_timestamp)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_LogEntry = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_LogEntry); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_timestamp = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_timestamp; MemberId member_id_timestamp = 0x00000004; - if (EK_COMPLETE == type_ids_LogEntry.type_identifier1()._d() || TK_NONE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier1()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier1()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_timestamp.type_identifier1()._d() || TK_NONE == type_ids_timestamp.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_timestamp.type_identifier1()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_timestamp.type_identifier1()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_timestamp.type_identifier1()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_timestamp.type_identifier1()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_timestamp.type_identifier1()._d() && + (EK_COMPLETE == type_ids_timestamp.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_timestamp.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_timestamp.type_identifier1()._d() && + (EK_COMPLETE == type_ids_timestamp.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_timestamp.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, member_flags_timestamp, type_ids_LogEntry.type_identifier1()); + common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, + member_flags_timestamp, type_ids_timestamp.type_identifier1()); } - else if (EK_COMPLETE == type_ids_LogEntry.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_LogEntry.type_identifier2()._d() && - EK_COMPLETE == type_ids_LogEntry.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_LogEntry.type_identifier2()._d() && - (EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_LogEntry.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_timestamp.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_timestamp.type_identifier2()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_timestamp.type_identifier2()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_timestamp.type_identifier2()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_timestamp.type_identifier2()._d() && + EK_COMPLETE == type_ids_timestamp.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_timestamp.type_identifier2()._d() && + (EK_COMPLETE == type_ids_timestamp.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_timestamp.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_timestamp.type_identifier2()._d() && + (EK_COMPLETE == type_ids_timestamp.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_timestamp.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, member_flags_timestamp, type_ids_LogEntry.type_identifier2()); + common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, + member_flags_timestamp, type_ids_timestamp.type_identifier2()); } else { @@ -561,20 +486,11 @@ void register_LogEntry_type_identifier() } CompleteStructType struct_type_LogEntry = TypeObjectUtils::build_complete_struct_type(struct_flags_LogEntry, header_LogEntry, member_seq_LogEntry); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_LogEntry, type_name_LogEntry.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_LogEntry, type_name_LogEntry.to_string(), type_ids_LogEntry)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "LogEntry already registered in TypeObjectRegistry for a different type."); } - return_code_LogEntry = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "LogEntry", type_ids_LogEntry); - if (return_code_LogEntry != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "LogEntry: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx index 27d724e3..d6568bf0 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx @@ -219,9 +219,10 @@ bool MonitoringErrorStatusPubSubType::getKey( return true; } -void MonitoringErrorStatusPubSubType::register_type_object_representation() const +void MonitoringErrorStatusPubSubType::register_type_object_representation() { - register_MonitoringStatus_type_objects(); + eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; + register_MonitoringErrorStatus_type_identifier(type_ids); } MonitoringStatusPubSubType::MonitoringStatusPubSubType() @@ -412,9 +413,10 @@ bool MonitoringStatusPubSubType::getKey( return true; } -void MonitoringStatusPubSubType::register_type_object_representation() const +void MonitoringStatusPubSubType::register_type_object_representation() { - register_MonitoringStatus_type_objects(); + eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; + register_MonitoringStatus_type_identifier(type_ids); } diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx index ece4358d..f99fba42 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx @@ -38,25 +38,20 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_MonitoringStatus_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_MonitoringErrorStatus_type_identifier( + TypeIdentifierPair& type_ids_MonitoringErrorStatus) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_MonitoringErrorStatus_type_identifier(); - - register_MonitoringStatus_type_identifier(); - - }); -} -void register_MonitoringErrorStatus_type_identifier() -{ + ReturnCode_t return_code_MonitoringErrorStatus {eprosima::fastdds::dds::RETCODE_OK}; + return_code_MonitoringErrorStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringErrorStatus", type_ids_MonitoringErrorStatus); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitoringErrorStatus) { StructTypeFlag struct_flags_MonitoringErrorStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_MonitoringErrorStatus; - TypeIdentifierPair type_ids_MonitoringErrorStatus; + static_cast(return_code_MonitoringErrorStatus); QualifiedTypeName type_name_MonitoringErrorStatus = "MonitoringErrorStatus"; eprosima::fastcdr::optional type_ann_builtin_MonitoringErrorStatus; eprosima::fastcdr::optional ann_custom_MonitoringErrorStatus; @@ -65,11 +60,13 @@ void register_MonitoringErrorStatus_type_identifier() header_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringErrorStatus); CompleteStructMemberSeq member_seq_MonitoringErrorStatus; { - return_code_MonitoringErrorStatus = + TypeIdentifierPair type_ids_type_mismatch; + ReturnCode_t return_code_type_mismatch {eprosima::fastdds::dds::RETCODE_OK}; + return_code_type_mismatch = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_MonitoringErrorStatus); + "_bool", type_ids_type_mismatch); - if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_type_mismatch) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -79,41 +76,43 @@ void register_MonitoringErrorStatus_type_identifier() false, false, false, false); CommonStructMember common_type_mismatch; MemberId member_id_type_mismatch = 0x00000000; - if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_type_mismatch.type_identifier1()._d() || TK_NONE == type_ids_type_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, + member_flags_type_mismatch, type_ids_type_mismatch.type_identifier1()); } - else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_type_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, + member_flags_type_mismatch, type_ids_type_mismatch.type_identifier2()); } else { @@ -129,11 +128,13 @@ void register_MonitoringErrorStatus_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringErrorStatus, member_type_mismatch); } { - return_code_MonitoringErrorStatus = + TypeIdentifierPair type_ids_qos_mismatch; + ReturnCode_t return_code_qos_mismatch {eprosima::fastdds::dds::RETCODE_OK}; + return_code_qos_mismatch = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_MonitoringErrorStatus); + "_bool", type_ids_qos_mismatch); - if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_qos_mismatch) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -143,41 +144,43 @@ void register_MonitoringErrorStatus_type_identifier() false, false, false, false); CommonStructMember common_qos_mismatch; MemberId member_id_qos_mismatch = 0x00000001; - if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1()._d() || TK_NONE == type_ids_qos_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, + member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier1()); } - else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, + member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier2()); } else { @@ -194,29 +197,27 @@ void register_MonitoringErrorStatus_type_identifier() } CompleteStructType struct_type_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringErrorStatus, header_MonitoringErrorStatus, member_seq_MonitoringErrorStatus); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string(), type_ids_MonitoringErrorStatus)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "MonitoringErrorStatus already registered in TypeObjectRegistry for a different type."); } - return_code_MonitoringErrorStatus = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MonitoringErrorStatus", type_ids_MonitoringErrorStatus); - if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MonitoringErrorStatus: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_MonitoringStatus_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_MonitoringStatus_type_identifier( + TypeIdentifierPair& type_ids_MonitoringStatus) { + + ReturnCode_t return_code_MonitoringStatus {eprosima::fastdds::dds::RETCODE_OK}; + return_code_MonitoringStatus = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringStatus", type_ids_MonitoringStatus); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitoringStatus) { StructTypeFlag struct_flags_MonitoringStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_MonitoringStatus; - TypeIdentifierPair type_ids_MonitoringStatus; + static_cast(return_code_MonitoringStatus); QualifiedTypeName type_name_MonitoringStatus = "MonitoringStatus"; eprosima::fastcdr::optional type_ann_builtin_MonitoringStatus; eprosima::fastcdr::optional ann_custom_MonitoringStatus; @@ -225,209 +226,57 @@ void register_MonitoringStatus_type_identifier() header_MonitoringStatus = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringStatus); CompleteStructMemberSeq member_seq_MonitoringStatus; { - return_code_MonitoringStatus = + TypeIdentifierPair type_ids_error_status; + ReturnCode_t return_code_error_status {eprosima::fastdds::dds::RETCODE_OK}; + return_code_error_status = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MonitoringErrorStatus", type_ids_MonitoringStatus); + "MonitoringErrorStatus", type_ids_error_status); - if (return_code_MonitoringStatus != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_error_status) { - { - StructTypeFlag struct_flags_MonitoringErrorStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_MonitoringErrorStatus; - TypeIdentifierPair type_ids_MonitoringErrorStatus; - QualifiedTypeName type_name_MonitoringErrorStatus = "MonitoringErrorStatus"; - eprosima::fastcdr::optional type_ann_builtin_MonitoringErrorStatus; - eprosima::fastcdr::optional ann_custom_MonitoringErrorStatus; - CompleteTypeDetail detail_MonitoringErrorStatus = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MonitoringErrorStatus, ann_custom_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string()); - CompleteStructHeader header_MonitoringErrorStatus; - header_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringErrorStatus); - CompleteStructMemberSeq member_seq_MonitoringErrorStatus; - { - return_code_MonitoringErrorStatus = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_MonitoringErrorStatus); - - if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_type_mismatch; - MemberId member_id_type_mismatch = 0x00000000; - if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_mismatch member TypeIdentifier inconsistent."); - return; - } - MemberName name_type_mismatch = "type_mismatch"; - eprosima::fastcdr::optional member_ann_builtin_type_mismatch; - ann_custom_MonitoringErrorStatus.reset(); - CompleteMemberDetail detail_type_mismatch = TypeObjectUtils::build_complete_member_detail(name_type_mismatch, member_ann_builtin_type_mismatch, ann_custom_MonitoringErrorStatus); - CompleteStructMember member_type_mismatch = TypeObjectUtils::build_complete_struct_member(common_type_mismatch, detail_type_mismatch); - TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringErrorStatus, member_type_mismatch); - } - { - return_code_MonitoringErrorStatus = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_MonitoringErrorStatus); - - if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_qos_mismatch; - MemberId member_id_qos_mismatch = 0x00000001; - if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringErrorStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringErrorStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_MonitoringErrorStatus.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure qos_mismatch member TypeIdentifier inconsistent."); - return; - } - MemberName name_qos_mismatch = "qos_mismatch"; - eprosima::fastcdr::optional member_ann_builtin_qos_mismatch; - ann_custom_MonitoringErrorStatus.reset(); - CompleteMemberDetail detail_qos_mismatch = TypeObjectUtils::build_complete_member_detail(name_qos_mismatch, member_ann_builtin_qos_mismatch, ann_custom_MonitoringErrorStatus); - CompleteStructMember member_qos_mismatch = TypeObjectUtils::build_complete_struct_member(common_qos_mismatch, detail_qos_mismatch); - TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringErrorStatus, member_qos_mismatch); - } - CompleteStructType struct_type_MonitoringErrorStatus = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringErrorStatus, header_MonitoringErrorStatus, member_seq_MonitoringErrorStatus); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringErrorStatus, type_name_MonitoringErrorStatus.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MonitoringErrorStatus already registered in TypeObjectRegistry for a different type."); - } - return_code_MonitoringErrorStatus = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MonitoringErrorStatus", type_ids_MonitoringErrorStatus); - if (return_code_MonitoringErrorStatus != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MonitoringErrorStatus: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_MonitoringErrorStatus_type_identifier(type_ids_error_status); } StructMemberFlag member_flags_error_status = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_error_status; MemberId member_id_error_status = 0x00000000; - if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_error_status.type_identifier1()._d() || TK_NONE == type_ids_error_status.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_error_status.type_identifier1()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_error_status.type_identifier1()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_error_status.type_identifier1()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_error_status.type_identifier1()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_error_status.type_identifier1()._d() && + (EK_COMPLETE == type_ids_error_status.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_error_status.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_error_status.type_identifier1()._d() && + (EK_COMPLETE == type_ids_error_status.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_error_status.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, member_flags_error_status, type_ids_MonitoringStatus.type_identifier1()); + common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, + member_flags_error_status, type_ids_error_status.type_identifier1()); } - else if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_error_status.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_error_status.type_identifier2()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_error_status.type_identifier2()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_error_status.type_identifier2()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_error_status.type_identifier2()._d() && + EK_COMPLETE == type_ids_error_status.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_error_status.type_identifier2()._d() && + (EK_COMPLETE == type_ids_error_status.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_error_status.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_error_status.type_identifier2()._d() && + (EK_COMPLETE == type_ids_error_status.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_error_status.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, member_flags_error_status, type_ids_MonitoringStatus.type_identifier2()); + common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, + member_flags_error_status, type_ids_error_status.type_identifier2()); } else { @@ -443,11 +292,13 @@ void register_MonitoringStatus_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_MonitoringStatus, member_error_status); } { - return_code_MonitoringStatus = + TypeIdentifierPair type_ids_has_errors; + ReturnCode_t return_code_has_errors {eprosima::fastdds::dds::RETCODE_OK}; + return_code_has_errors = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_MonitoringStatus); + "_bool", type_ids_has_errors); - if (return_code_MonitoringStatus != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_has_errors) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "has_errors Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -457,41 +308,43 @@ void register_MonitoringStatus_type_identifier() false, false, false, false); CommonStructMember common_has_errors; MemberId member_id_has_errors = 0x00000001; - if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1()._d() || TK_NONE == type_ids_MonitoringStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_has_errors.type_identifier1()._d() || TK_NONE == type_ids_has_errors.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_has_errors.type_identifier1()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_has_errors.type_identifier1()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_has_errors.type_identifier1()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_has_errors.type_identifier1()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_has_errors.type_identifier1()._d() && + (EK_COMPLETE == type_ids_has_errors.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_has_errors.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_has_errors.type_identifier1()._d() && + (EK_COMPLETE == type_ids_has_errors.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_has_errors.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, member_flags_has_errors, type_ids_MonitoringStatus.type_identifier1()); + common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, + member_flags_has_errors, type_ids_has_errors.type_identifier1()); } - else if (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringStatus.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringStatus.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_has_errors.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_has_errors.type_identifier2()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_has_errors.type_identifier2()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_has_errors.type_identifier2()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_has_errors.type_identifier2()._d() && + EK_COMPLETE == type_ids_has_errors.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_has_errors.type_identifier2()._d() && + (EK_COMPLETE == type_ids_has_errors.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_has_errors.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_has_errors.type_identifier2()._d() && + (EK_COMPLETE == type_ids_has_errors.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_has_errors.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, member_flags_has_errors, type_ids_MonitoringStatus.type_identifier2()); + common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, + member_flags_has_errors, type_ids_has_errors.type_identifier2()); } else { @@ -508,20 +361,11 @@ void register_MonitoringStatus_type_identifier() } CompleteStructType struct_type_MonitoringStatus = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringStatus, header_MonitoringStatus, member_seq_MonitoringStatus); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringStatus, type_name_MonitoringStatus.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringStatus, type_name_MonitoringStatus.to_string(), type_ids_MonitoringStatus)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "MonitoringStatus already registered in TypeObjectRegistry for a different type."); } - return_code_MonitoringStatus = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MonitoringStatus", type_ids_MonitoringStatus); - if (return_code_MonitoringStatus != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MonitoringStatus: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx index e83fa85e..a1198206 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx @@ -219,9 +219,10 @@ bool DdsTopicDataPubSubType::getKey( return true; } -void DdsTopicDataPubSubType::register_type_object_representation() const +void DdsTopicDataPubSubType::register_type_object_representation() { - register_MonitoringTopics_type_objects(); + eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; + register_DdsTopicData_type_identifier(type_ids); } DdsTopicPubSubType::DdsTopicPubSubType() @@ -412,9 +413,10 @@ bool DdsTopicPubSubType::getKey( return true; } -void DdsTopicPubSubType::register_type_object_representation() const +void DdsTopicPubSubType::register_type_object_representation() { - register_MonitoringTopics_type_objects(); + eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; + register_DdsTopic_type_identifier(type_ids); } MonitoringTopicsPubSubType::MonitoringTopicsPubSubType() @@ -605,9 +607,10 @@ bool MonitoringTopicsPubSubType::getKey( return true; } -void MonitoringTopicsPubSubType::register_type_object_representation() const +void MonitoringTopicsPubSubType::register_type_object_representation() { - register_MonitoringTopics_type_objects(); + eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; + register_MonitoringTopics_type_identifier(type_ids); } diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx index 671d45a8..0e57c309 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx @@ -38,27 +38,20 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_MonitoringTopics_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_DdsTopicData_type_identifier( + TypeIdentifierPair& type_ids_DdsTopicData) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_DdsTopicData_type_identifier(); - - register_DdsTopic_type_identifier(); - - register_MonitoringTopics_type_identifier(); - - }); -} -void register_DdsTopicData_type_identifier() -{ + ReturnCode_t return_code_DdsTopicData {eprosima::fastdds::dds::RETCODE_OK}; + return_code_DdsTopicData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopicData", type_ids_DdsTopicData); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_DdsTopicData) { StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_DdsTopicData; - TypeIdentifierPair type_ids_DdsTopicData; + static_cast(return_code_DdsTopicData); QualifiedTypeName type_name_DdsTopicData = "DdsTopicData"; eprosima::fastcdr::optional type_ann_builtin_DdsTopicData; eprosima::fastcdr::optional ann_custom_DdsTopicData; @@ -67,92 +60,67 @@ void register_DdsTopicData_type_identifier() header_DdsTopicData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopicData); CompleteStructMemberSeq member_seq_DdsTopicData; { - return_code_DdsTopicData = + TypeIdentifierPair type_ids_participant_id; + ReturnCode_t return_code_participant_id {eprosima::fastdds::dds::RETCODE_OK}; + return_code_participant_id = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopicData); + "anonymous_string_unbounded", type_ids_participant_id); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_participant_id) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_participant_id)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopicData); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_participant_id; MemberId member_id_participant_id = 0x00000000; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_participant_id.type_identifier1()._d() || TK_NONE == type_ids_participant_id.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_participant_id.type_identifier1()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_participant_id.type_identifier1()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_participant_id.type_identifier1()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_participant_id.type_identifier1()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_participant_id.type_identifier1()._d() && + (EK_COMPLETE == type_ids_participant_id.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_participant_id.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_participant_id.type_identifier1()._d() && + (EK_COMPLETE == type_ids_participant_id.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_participant_id.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier1()); + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, + member_flags_participant_id, type_ids_participant_id.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_participant_id.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_participant_id.type_identifier2()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_participant_id.type_identifier2()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_participant_id.type_identifier2()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_participant_id.type_identifier2()._d() && + EK_COMPLETE == type_ids_participant_id.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_participant_id.type_identifier2()._d() && + (EK_COMPLETE == type_ids_participant_id.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_participant_id.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_participant_id.type_identifier2()._d() && + (EK_COMPLETE == type_ids_participant_id.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_participant_id.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier2()); + common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, + member_flags_participant_id, type_ids_participant_id.type_identifier2()); } else { @@ -168,11 +136,13 @@ void register_DdsTopicData_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_participant_id); } { - return_code_DdsTopicData = + TypeIdentifierPair type_ids_msgs_lost; + ReturnCode_t return_code_msgs_lost {eprosima::fastdds::dds::RETCODE_OK}; + return_code_msgs_lost = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_DdsTopicData); + "_uint32_t", type_ids_msgs_lost); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_msgs_lost) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "msgs_lost Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -182,41 +152,43 @@ void register_DdsTopicData_type_identifier() false, false, false, false); CommonStructMember common_msgs_lost; MemberId member_id_msgs_lost = 0x00000001; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_msgs_lost.type_identifier1()._d() || TK_NONE == type_ids_msgs_lost.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_lost.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_lost.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_lost.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_lost.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_msgs_lost.type_identifier1()._d() && + (EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_msgs_lost.type_identifier1()._d() && + (EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier1()); + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, + member_flags_msgs_lost, type_ids_msgs_lost.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_msgs_lost.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_lost.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_lost.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_lost.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_lost.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_lost.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_msgs_lost.type_identifier2()._d() && + (EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_msgs_lost.type_identifier2()._d() && + (EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier2()); + common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, + member_flags_msgs_lost, type_ids_msgs_lost.type_identifier2()); } else { @@ -232,11 +204,13 @@ void register_DdsTopicData_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_lost); } { - return_code_DdsTopicData = + TypeIdentifierPair type_ids_msgs_received; + ReturnCode_t return_code_msgs_received {eprosima::fastdds::dds::RETCODE_OK}; + return_code_msgs_received = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_DdsTopicData); + "_uint32_t", type_ids_msgs_received); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_msgs_received) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "msgs_received Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -246,41 +220,43 @@ void register_DdsTopicData_type_identifier() false, false, false, false); CommonStructMember common_msgs_received; MemberId member_id_msgs_received = 0x00000002; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_msgs_received.type_identifier1()._d() || TK_NONE == type_ids_msgs_received.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_received.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_received.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_received.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_received.type_identifier1()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_msgs_received.type_identifier1()._d() && + (EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_msgs_received.type_identifier1()._d() && + (EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier1()); + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, + member_flags_msgs_received, type_ids_msgs_received.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_msgs_received.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_received.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_received.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_received.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_received.type_identifier2()._d() && + EK_COMPLETE == type_ids_msgs_received.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_msgs_received.type_identifier2()._d() && + (EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_msgs_received.type_identifier2()._d() && + (EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier2()); + common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, + member_flags_msgs_received, type_ids_msgs_received.type_identifier2()); } else { @@ -296,11 +272,13 @@ void register_DdsTopicData_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_received); } { - return_code_DdsTopicData = + TypeIdentifierPair type_ids_msg_rx_rate; + ReturnCode_t return_code_msg_rx_rate {eprosima::fastdds::dds::RETCODE_OK}; + return_code_msg_rx_rate = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_DdsTopicData); + "_double", type_ids_msg_rx_rate); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_msg_rx_rate) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "msg_rx_rate Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -310,41 +288,43 @@ void register_DdsTopicData_type_identifier() false, false, false, false); CommonStructMember common_msg_rx_rate; MemberId member_id_msg_rx_rate = 0x00000003; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1()._d() || TK_NONE == type_ids_msg_rx_rate.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_msg_rx_rate.type_identifier1()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_msg_rx_rate.type_identifier1()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_msg_rx_rate.type_identifier1()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_msg_rx_rate.type_identifier1()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_msg_rx_rate.type_identifier1()._d() && + (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_msg_rx_rate.type_identifier1()._d() && + (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier1()); + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, + member_flags_msg_rx_rate, type_ids_msg_rx_rate.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_msg_rx_rate.type_identifier2()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_msg_rx_rate.type_identifier2()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_msg_rx_rate.type_identifier2()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_msg_rx_rate.type_identifier2()._d() && + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_msg_rx_rate.type_identifier2()._d() && + (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_msg_rx_rate.type_identifier2()._d() && + (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier2()); + common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, + member_flags_msg_rx_rate, type_ids_msg_rx_rate.type_identifier2()); } else { @@ -361,29 +341,27 @@ void register_DdsTopicData_type_identifier() } CompleteStructType struct_type_DdsTopicData = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopicData, header_DdsTopicData, member_seq_DdsTopicData); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopicData, type_name_DdsTopicData.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopicData, type_name_DdsTopicData.to_string(), type_ids_DdsTopicData)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "DdsTopicData already registered in TypeObjectRegistry for a different type."); } - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopicData", type_ids_DdsTopicData); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopicData: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_DdsTopic_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_DdsTopic_type_identifier( + TypeIdentifierPair& type_ids_DdsTopic) { + + ReturnCode_t return_code_DdsTopic {eprosima::fastdds::dds::RETCODE_OK}; + return_code_DdsTopic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "DdsTopic", type_ids_DdsTopic); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_DdsTopic) { StructTypeFlag struct_flags_DdsTopic = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_DdsTopic; - TypeIdentifierPair type_ids_DdsTopic; + static_cast(return_code_DdsTopic); QualifiedTypeName type_name_DdsTopic = "DdsTopic"; eprosima::fastcdr::optional type_ann_builtin_DdsTopic; eprosima::fastcdr::optional ann_custom_DdsTopic; @@ -392,92 +370,67 @@ void register_DdsTopic_type_identifier() header_DdsTopic = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopic); CompleteStructMemberSeq member_seq_DdsTopic; { - return_code_DdsTopic = + TypeIdentifierPair type_ids_name; + ReturnCode_t return_code_name {eprosima::fastdds::dds::RETCODE_OK}; + return_code_name = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); + "anonymous_string_unbounded", type_ids_name); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_name) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_name)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_name; MemberId member_id_name = 0x00000000; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_name.type_identifier1()._d() || TK_NONE == type_ids_name.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_name.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_name.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_name.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_name.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_name.type_identifier1()._d() && + (EK_COMPLETE == type_ids_name.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_name.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_name.type_identifier1()._d() && + (EK_COMPLETE == type_ids_name.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_name.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier1()); + common_name = TypeObjectUtils::build_common_struct_member(member_id_name, + member_flags_name, type_ids_name.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_name.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_name.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_name.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_name.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_name.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_name.type_identifier2()._d() && + (EK_COMPLETE == type_ids_name.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_name.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_name.type_identifier2()._d() && + (EK_COMPLETE == type_ids_name.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_name.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier2()); + common_name = TypeObjectUtils::build_common_struct_member(member_id_name, + member_flags_name, type_ids_name.type_identifier2()); } else { @@ -493,92 +446,67 @@ void register_DdsTopic_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_name); } { - return_code_DdsTopic = + TypeIdentifierPair type_ids_type_name; + ReturnCode_t return_code_type_name {eprosima::fastdds::dds::RETCODE_OK}; + return_code_type_name = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); + "anonymous_string_unbounded", type_ids_type_name); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_type_name) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_type_name)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_type_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_type_name; MemberId member_id_type_name = 0x00000001; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_type_name.type_identifier1()._d() || TK_NONE == type_ids_type_name.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_name.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_name.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_name.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_name.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_name.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_name.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_name.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier1()); + common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, + member_flags_type_name, type_ids_type_name.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_type_name.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_name.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_name.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_name.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_name.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_name.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_name.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_name.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_name.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier2()); + common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, + member_flags_type_name, type_ids_type_name.type_identifier2()); } else { @@ -594,11 +522,13 @@ void register_DdsTopic_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_name); } { - return_code_DdsTopic = + TypeIdentifierPair type_ids_type_discovered; + ReturnCode_t return_code_type_discovered {eprosima::fastdds::dds::RETCODE_OK}; + return_code_type_discovered = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_DdsTopic); + "_bool", type_ids_type_discovered); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_type_discovered) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "type_discovered Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -608,41 +538,43 @@ void register_DdsTopic_type_identifier() false, false, false, false); CommonStructMember common_type_discovered; MemberId member_id_type_discovered = 0x00000002; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_type_discovered.type_identifier1()._d() || TK_NONE == type_ids_type_discovered.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_discovered.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_discovered.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_discovered.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_discovered.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_discovered.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_discovered.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier1()); + common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, + member_flags_type_discovered, type_ids_type_discovered.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_type_discovered.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_discovered.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_discovered.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_discovered.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_discovered.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_discovered.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_discovered.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_discovered.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier2()); + common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, + member_flags_type_discovered, type_ids_type_discovered.type_identifier2()); } else { @@ -658,11 +590,13 @@ void register_DdsTopic_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_discovered); } { - return_code_DdsTopic = + TypeIdentifierPair type_ids_type_mismatch; + ReturnCode_t return_code_type_mismatch {eprosima::fastdds::dds::RETCODE_OK}; + return_code_type_mismatch = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_DdsTopic); + "_bool", type_ids_type_mismatch); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_type_mismatch) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -672,41 +606,43 @@ void register_DdsTopic_type_identifier() false, false, false, false); CommonStructMember common_type_mismatch; MemberId member_id_type_mismatch = 0x00000003; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_type_mismatch.type_identifier1()._d() || TK_NONE == type_ids_type_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier1()); + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, + member_flags_type_mismatch, type_ids_type_mismatch.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_type_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier2()); + common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, + member_flags_type_mismatch, type_ids_type_mismatch.type_identifier2()); } else { @@ -722,11 +658,13 @@ void register_DdsTopic_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_mismatch); } { - return_code_DdsTopic = + TypeIdentifierPair type_ids_qos_mismatch; + ReturnCode_t return_code_qos_mismatch {eprosima::fastdds::dds::RETCODE_OK}; + return_code_qos_mismatch = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_DdsTopic); + "_bool", type_ids_qos_mismatch); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_qos_mismatch) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -736,41 +674,43 @@ void register_DdsTopic_type_identifier() false, false, false, false); CommonStructMember common_qos_mismatch; MemberId member_id_qos_mismatch = 0x00000004; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1()._d() || TK_NONE == type_ids_qos_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier1()); + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, + member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && + (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier2()); + common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, + member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier2()); } else { @@ -786,377 +726,58 @@ void register_DdsTopic_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_qos_mismatch); } { - return_code_DdsTopic = + TypeIdentifierPair type_ids_data; + ReturnCode_t return_code_data {eprosima::fastdds::dds::RETCODE_OK}; + return_code_data = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); + "anonymous_sequence_DdsTopicData_unbounded", type_ids_data); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_data) { - return_code_DdsTopic = + return_code_data = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopicData", type_ids_DdsTopic); + "DdsTopicData", type_ids_data); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_data) { - { - StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_DdsTopicData; - TypeIdentifierPair type_ids_DdsTopicData; - QualifiedTypeName type_name_DdsTopicData = "DdsTopicData"; - eprosima::fastcdr::optional type_ann_builtin_DdsTopicData; - eprosima::fastcdr::optional ann_custom_DdsTopicData; - CompleteTypeDetail detail_DdsTopicData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopicData, ann_custom_DdsTopicData, type_name_DdsTopicData.to_string()); - CompleteStructHeader header_DdsTopicData; - header_DdsTopicData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopicData); - CompleteStructMemberSeq member_seq_DdsTopicData; - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopicData); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_participant_id; - MemberId member_id_participant_id = 0x00000000; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure participant_id member TypeIdentifier inconsistent."); - return; - } - MemberName name_participant_id = "participant_id"; - eprosima::fastcdr::optional member_ann_builtin_participant_id; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_participant_id = TypeObjectUtils::build_complete_member_detail(name_participant_id, member_ann_builtin_participant_id, ann_custom_DdsTopicData); - CompleteStructMember member_participant_id = TypeObjectUtils::build_complete_struct_member(common_participant_id, detail_participant_id); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_participant_id); - } - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "msgs_lost Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_msgs_lost; - MemberId member_id_msgs_lost = 0x00000001; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msgs_lost member TypeIdentifier inconsistent."); - return; - } - MemberName name_msgs_lost = "msgs_lost"; - eprosima::fastcdr::optional member_ann_builtin_msgs_lost; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_msgs_lost = TypeObjectUtils::build_complete_member_detail(name_msgs_lost, member_ann_builtin_msgs_lost, ann_custom_DdsTopicData); - CompleteStructMember member_msgs_lost = TypeObjectUtils::build_complete_struct_member(common_msgs_lost, detail_msgs_lost); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_lost); - } - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "msgs_received Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_msgs_received; - MemberId member_id_msgs_received = 0x00000002; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msgs_received member TypeIdentifier inconsistent."); - return; - } - MemberName name_msgs_received = "msgs_received"; - eprosima::fastcdr::optional member_ann_builtin_msgs_received; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_msgs_received = TypeObjectUtils::build_complete_member_detail(name_msgs_received, member_ann_builtin_msgs_received, ann_custom_DdsTopicData); - CompleteStructMember member_msgs_received = TypeObjectUtils::build_complete_struct_member(common_msgs_received, detail_msgs_received); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_received); - } - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "msg_rx_rate Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_msg_rx_rate; - MemberId member_id_msg_rx_rate = 0x00000003; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msg_rx_rate member TypeIdentifier inconsistent."); - return; - } - MemberName name_msg_rx_rate = "msg_rx_rate"; - eprosima::fastcdr::optional member_ann_builtin_msg_rx_rate; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_msg_rx_rate = TypeObjectUtils::build_complete_member_detail(name_msg_rx_rate, member_ann_builtin_msg_rx_rate, ann_custom_DdsTopicData); - CompleteStructMember member_msg_rx_rate = TypeObjectUtils::build_complete_struct_member(common_msg_rx_rate, detail_msg_rx_rate); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msg_rx_rate); - } - CompleteStructType struct_type_DdsTopicData = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopicData, header_DdsTopicData, member_seq_DdsTopicData); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopicData, type_name_DdsTopicData.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopicData already registered in TypeObjectRegistry for a different type."); - } - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopicData", type_ids_DdsTopicData); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopicData: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_DdsTopicData_type_identifier(type_ids_data); } TypeIdentifier* element_identifier_anonymous_sequence_DdsTopicData_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_data.type_identifier1()._d() || TK_NONE == type_ids_data.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier1()._d() && + (EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier1()._d() && + (EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().key_identifier()->_d()))) { - element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier1()); + element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_data.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_data.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier2()._d() && + (EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier2()._d() && + (EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().key_identifier()->_d()))) { - element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier2()); + element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_data.type_identifier2()); } else { @@ -1165,86 +786,65 @@ void register_DdsTopic_type_identifier() return; } EquivalenceKind equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_DdsTopic.type_identifier2()._d()) + if (TK_NONE == type_ids_data.type_identifier2()._d()) { equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_DdsTopicData_unbounded = 0; PlainCollectionHeader header_anonymous_sequence_DdsTopicData_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_DdsTopicData_unbounded, element_flags_anonymous_sequence_DdsTopicData_unbounded); - std::string type_id_kind_anonymous_sequence_DdsTopicData_unbounded("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_DdsTopicData_unbounded == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = 0; PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopicData_unbounded")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopicData_unbounded", type_ids_data)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - LBound bound = 0; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_DdsTopicData_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_DdsTopicData_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_data; MemberId member_id_data = 0x00000005; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_data.type_identifier1()._d() || TK_NONE == type_ids_data.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier1()._d() && + EK_COMPLETE == type_ids_data.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier1()._d() && + (EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier1()._d() && + (EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier1()); + common_data = TypeObjectUtils::build_common_struct_member(member_id_data, + member_flags_data, type_ids_data.type_identifier1()); } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_data.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier2()._d() && + EK_COMPLETE == type_ids_data.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier2()._d() && + (EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier2()._d() && + (EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier2()); + common_data = TypeObjectUtils::build_common_struct_member(member_id_data, + member_flags_data, type_ids_data.type_identifier2()); } else { @@ -1261,29 +861,27 @@ void register_DdsTopic_type_identifier() } CompleteStructType struct_type_DdsTopic = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopic, header_DdsTopic, member_seq_DdsTopic); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopic, type_name_DdsTopic.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopic, type_name_DdsTopic.to_string(), type_ids_DdsTopic)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "DdsTopic already registered in TypeObjectRegistry for a different type."); } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopic", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopic: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_MonitoringTopics_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_MonitoringTopics_type_identifier( + TypeIdentifierPair& type_ids_MonitoringTopics) { + + ReturnCode_t return_code_MonitoringTopics {eprosima::fastdds::dds::RETCODE_OK}; + return_code_MonitoringTopics = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MonitoringTopics", type_ids_MonitoringTopics); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitoringTopics) { StructTypeFlag struct_flags_MonitoringTopics = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_MonitoringTopics; - TypeIdentifierPair type_ids_MonitoringTopics; + static_cast(return_code_MonitoringTopics); QualifiedTypeName type_name_MonitoringTopics = "MonitoringTopics"; eprosima::fastcdr::optional type_ann_builtin_MonitoringTopics; eprosima::fastcdr::optional ann_custom_MonitoringTopics; @@ -1292,952 +890,58 @@ void register_MonitoringTopics_type_identifier() header_MonitoringTopics = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitoringTopics); CompleteStructMemberSeq member_seq_MonitoringTopics; { - return_code_MonitoringTopics = + TypeIdentifierPair type_ids_topics; + ReturnCode_t return_code_topics {eprosima::fastdds::dds::RETCODE_OK}; + return_code_topics = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_DdsTopic_unbounded", type_ids_MonitoringTopics); + "anonymous_sequence_DdsTopic_unbounded", type_ids_topics); - if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_topics) { - return_code_MonitoringTopics = + return_code_topics = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopic", type_ids_MonitoringTopics); + "DdsTopic", type_ids_topics); - if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_topics) { - { - StructTypeFlag struct_flags_DdsTopic = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_DdsTopic; - TypeIdentifierPair type_ids_DdsTopic; - QualifiedTypeName type_name_DdsTopic = "DdsTopic"; - eprosima::fastcdr::optional type_ann_builtin_DdsTopic; - eprosima::fastcdr::optional ann_custom_DdsTopic; - CompleteTypeDetail detail_DdsTopic = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopic, ann_custom_DdsTopic, type_name_DdsTopic.to_string()); - CompleteStructHeader header_DdsTopic; - header_DdsTopic = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopic); - CompleteStructMemberSeq member_seq_DdsTopic; - { - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); - - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_name; - MemberId member_id_name = 0x00000000; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_name = TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, type_ids_DdsTopic.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure name member TypeIdentifier inconsistent."); - return; - } - MemberName name_name = "name"; - eprosima::fastcdr::optional member_ann_builtin_name; - ann_custom_DdsTopic.reset(); - CompleteMemberDetail detail_name = TypeObjectUtils::build_complete_member_detail(name_name, member_ann_builtin_name, ann_custom_DdsTopic); - CompleteStructMember member_name = TypeObjectUtils::build_complete_struct_member(common_name, detail_name); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_name); - } - { - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); - - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_type_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_type_name; - MemberId member_id_type_name = 0x00000001; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, type_ids_DdsTopic.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_name member TypeIdentifier inconsistent."); - return; - } - MemberName name_type_name = "type_name"; - eprosima::fastcdr::optional member_ann_builtin_type_name; - ann_custom_DdsTopic.reset(); - CompleteMemberDetail detail_type_name = TypeObjectUtils::build_complete_member_detail(name_type_name, member_ann_builtin_type_name, ann_custom_DdsTopic); - CompleteStructMember member_type_name = TypeObjectUtils::build_complete_struct_member(common_type_name, detail_type_name); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_name); - } - { - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_DdsTopic); - - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "type_discovered Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_type_discovered = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_type_discovered; - MemberId member_id_type_discovered = 0x00000002; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, type_ids_DdsTopic.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_discovered member TypeIdentifier inconsistent."); - return; - } - MemberName name_type_discovered = "type_discovered"; - eprosima::fastcdr::optional member_ann_builtin_type_discovered; - ann_custom_DdsTopic.reset(); - CompleteMemberDetail detail_type_discovered = TypeObjectUtils::build_complete_member_detail(name_type_discovered, member_ann_builtin_type_discovered, ann_custom_DdsTopic); - CompleteStructMember member_type_discovered = TypeObjectUtils::build_complete_struct_member(common_type_discovered, detail_type_discovered); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_discovered); - } - { - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_DdsTopic); - - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_type_mismatch; - MemberId member_id_type_mismatch = 0x00000003; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, type_ids_DdsTopic.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_mismatch member TypeIdentifier inconsistent."); - return; - } - MemberName name_type_mismatch = "type_mismatch"; - eprosima::fastcdr::optional member_ann_builtin_type_mismatch; - ann_custom_DdsTopic.reset(); - CompleteMemberDetail detail_type_mismatch = TypeObjectUtils::build_complete_member_detail(name_type_mismatch, member_ann_builtin_type_mismatch, ann_custom_DdsTopic); - CompleteStructMember member_type_mismatch = TypeObjectUtils::build_complete_struct_member(common_type_mismatch, detail_type_mismatch); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_type_mismatch); - } - { - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_DdsTopic); - - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_qos_mismatch; - MemberId member_id_qos_mismatch = 0x00000004; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, type_ids_DdsTopic.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure qos_mismatch member TypeIdentifier inconsistent."); - return; - } - MemberName name_qos_mismatch = "qos_mismatch"; - eprosima::fastcdr::optional member_ann_builtin_qos_mismatch; - ann_custom_DdsTopic.reset(); - CompleteMemberDetail detail_qos_mismatch = TypeObjectUtils::build_complete_member_detail(name_qos_mismatch, member_ann_builtin_qos_mismatch, ann_custom_DdsTopic); - CompleteStructMember member_qos_mismatch = TypeObjectUtils::build_complete_struct_member(common_qos_mismatch, detail_qos_mismatch); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_qos_mismatch); - } - { - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); - - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopicData", type_ids_DdsTopic); - - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_DdsTopicData; - TypeIdentifierPair type_ids_DdsTopicData; - QualifiedTypeName type_name_DdsTopicData = "DdsTopicData"; - eprosima::fastcdr::optional type_ann_builtin_DdsTopicData; - eprosima::fastcdr::optional ann_custom_DdsTopicData; - CompleteTypeDetail detail_DdsTopicData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DdsTopicData, ann_custom_DdsTopicData, type_name_DdsTopicData.to_string()); - CompleteStructHeader header_DdsTopicData; - header_DdsTopicData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DdsTopicData); - CompleteStructMemberSeq member_seq_DdsTopicData; - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_DdsTopicData); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_participant_id; - MemberId member_id_participant_id = 0x00000000; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure participant_id member TypeIdentifier inconsistent."); - return; - } - MemberName name_participant_id = "participant_id"; - eprosima::fastcdr::optional member_ann_builtin_participant_id; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_participant_id = TypeObjectUtils::build_complete_member_detail(name_participant_id, member_ann_builtin_participant_id, ann_custom_DdsTopicData); - CompleteStructMember member_participant_id = TypeObjectUtils::build_complete_struct_member(common_participant_id, detail_participant_id); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_participant_id); - } - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "msgs_lost Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_msgs_lost; - MemberId member_id_msgs_lost = 0x00000001; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msgs_lost member TypeIdentifier inconsistent."); - return; - } - MemberName name_msgs_lost = "msgs_lost"; - eprosima::fastcdr::optional member_ann_builtin_msgs_lost; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_msgs_lost = TypeObjectUtils::build_complete_member_detail(name_msgs_lost, member_ann_builtin_msgs_lost, ann_custom_DdsTopicData); - CompleteStructMember member_msgs_lost = TypeObjectUtils::build_complete_struct_member(common_msgs_lost, detail_msgs_lost); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_lost); - } - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "msgs_received Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_msgs_received; - MemberId member_id_msgs_received = 0x00000002; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msgs_received member TypeIdentifier inconsistent."); - return; - } - MemberName name_msgs_received = "msgs_received"; - eprosima::fastcdr::optional member_ann_builtin_msgs_received; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_msgs_received = TypeObjectUtils::build_complete_member_detail(name_msgs_received, member_ann_builtin_msgs_received, ann_custom_DdsTopicData); - CompleteStructMember member_msgs_received = TypeObjectUtils::build_complete_struct_member(common_msgs_received, detail_msgs_received); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msgs_received); - } - { - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_DdsTopicData); - - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "msg_rx_rate Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_msg_rx_rate; - MemberId member_id_msg_rx_rate = 0x00000003; - if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1()._d() || TK_NONE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopicData.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopicData.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, type_ids_DdsTopicData.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msg_rx_rate member TypeIdentifier inconsistent."); - return; - } - MemberName name_msg_rx_rate = "msg_rx_rate"; - eprosima::fastcdr::optional member_ann_builtin_msg_rx_rate; - ann_custom_DdsTopicData.reset(); - CompleteMemberDetail detail_msg_rx_rate = TypeObjectUtils::build_complete_member_detail(name_msg_rx_rate, member_ann_builtin_msg_rx_rate, ann_custom_DdsTopicData); - CompleteStructMember member_msg_rx_rate = TypeObjectUtils::build_complete_struct_member(common_msg_rx_rate, detail_msg_rx_rate); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopicData, member_msg_rx_rate); - } - CompleteStructType struct_type_DdsTopicData = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopicData, header_DdsTopicData, member_seq_DdsTopicData); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopicData, type_name_DdsTopicData.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopicData already registered in TypeObjectRegistry for a different type."); - } - return_code_DdsTopicData = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopicData", type_ids_DdsTopicData); - if (return_code_DdsTopicData != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopicData: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_sequence_DdsTopicData_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_DdsTopic.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_DdsTopic.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_DdsTopicData_unbounded = 0; - PlainCollectionHeader header_anonymous_sequence_DdsTopicData_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_DdsTopicData_unbounded, element_flags_anonymous_sequence_DdsTopicData_unbounded); - std::string type_id_kind_anonymous_sequence_DdsTopicData_unbounded("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_DdsTopicData_unbounded == "TI_PLAIN_SEQUENCE_SMALL") - { - SBound bound = 0; - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopicData_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 0; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_DdsTopicData_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopicData_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_DdsTopicData_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_DdsTopicData_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_DdsTopicData_unbounded", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_DdsTopicData_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_data; - MemberId member_id_data = 0x00000005; - if (EK_COMPLETE == type_ids_DdsTopic.type_identifier1()._d() || TK_NONE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier1()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_DdsTopic.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_DdsTopic.type_identifier2()._d() && - (EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_DdsTopic.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_data = TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, type_ids_DdsTopic.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure data member TypeIdentifier inconsistent."); - return; - } - MemberName name_data = "data"; - eprosima::fastcdr::optional member_ann_builtin_data; - ann_custom_DdsTopic.reset(); - CompleteMemberDetail detail_data = TypeObjectUtils::build_complete_member_detail(name_data, member_ann_builtin_data, ann_custom_DdsTopic); - CompleteStructMember member_data = TypeObjectUtils::build_complete_struct_member(common_data, detail_data); - TypeObjectUtils::add_complete_struct_member(member_seq_DdsTopic, member_data); - } - CompleteStructType struct_type_DdsTopic = TypeObjectUtils::build_complete_struct_type(struct_flags_DdsTopic, header_DdsTopic, member_seq_DdsTopic); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_DdsTopic, type_name_DdsTopic.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopic already registered in TypeObjectRegistry for a different type."); - } - return_code_DdsTopic = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "DdsTopic", type_ids_DdsTopic); - if (return_code_DdsTopic != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "DdsTopic: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_DdsTopic_type_identifier(type_ids_topics); } TypeIdentifier* element_identifier_anonymous_sequence_DdsTopic_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1()._d() || TK_NONE == type_ids_MonitoringTopics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_topics.type_identifier1()._d() || TK_NONE == type_ids_topics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().key_identifier()->_d()))) { - element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_MonitoringTopics.type_identifier1()); + element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_topics.type_identifier1()); } - else if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_topics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().key_identifier()->_d()))) { - element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_MonitoringTopics.type_identifier2()); + element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_topics.type_identifier2()); } else { @@ -2246,86 +950,65 @@ void register_MonitoringTopics_type_identifier() return; } EquivalenceKind equiv_kind_anonymous_sequence_DdsTopic_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_MonitoringTopics.type_identifier2()._d()) + if (TK_NONE == type_ids_topics.type_identifier2()._d()) { equiv_kind_anonymous_sequence_DdsTopic_unbounded = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_DdsTopic_unbounded = 0; PlainCollectionHeader header_anonymous_sequence_DdsTopic_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_DdsTopic_unbounded, element_flags_anonymous_sequence_DdsTopic_unbounded); - std::string type_id_kind_anonymous_sequence_DdsTopic_unbounded("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_DdsTopic_unbounded == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = 0; PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_DdsTopic_unbounded, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopic_unbounded)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopic_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_DdsTopic_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 0; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_DdsTopic_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_DdsTopic_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_DdsTopic_unbounded")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_DdsTopic_unbounded", type_ids_topics)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_DdsTopic_unbounded already registered in TypeObjectRegistry for a different type."); } } - return_code_MonitoringTopics = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_DdsTopic_unbounded", type_ids_MonitoringTopics); - if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_DdsTopic_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_topics = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); CommonStructMember common_topics; MemberId member_id_topics = 0x00000000; - if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1()._d() || TK_NONE == type_ids_MonitoringTopics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (EK_COMPLETE == type_ids_topics.type_identifier1()._d() || TK_NONE == type_ids_topics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier1()._d() && + EK_COMPLETE == type_ids_topics.type_identifier1().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier1()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().key_identifier()->_d()))) { - common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, member_flags_topics, type_ids_MonitoringTopics.type_identifier1()); + common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, + member_flags_topics, type_ids_topics.type_identifier1()); } - else if (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MonitoringTopics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MonitoringTopics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MonitoringTopics.type_identifier2().map_ldefn().key_identifier()->_d()))) + else if (EK_COMPLETE == type_ids_topics.type_identifier2()._d() || + (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().seq_sdefn().header().equiv_kind()) || + (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().seq_ldefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().array_sdefn().header().equiv_kind()) || + (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier2()._d() && + EK_COMPLETE == type_ids_topics.type_identifier2().array_ldefn().header().equiv_kind()) || + (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().key_identifier()->_d())) || + (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier2()._d() && + (EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().header().equiv_kind() || + EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().key_identifier()->_d()))) { - common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, member_flags_topics, type_ids_MonitoringTopics.type_identifier2()); + common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, + member_flags_topics, type_ids_topics.type_identifier2()); } else { @@ -2342,20 +1025,11 @@ void register_MonitoringTopics_type_identifier() } CompleteStructType struct_type_MonitoringTopics = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitoringTopics, header_MonitoringTopics, member_seq_MonitoringTopics); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringTopics, type_name_MonitoringTopics.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitoringTopics, type_name_MonitoringTopics.to_string(), type_ids_MonitoringTopics)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "MonitoringTopics already registered in TypeObjectRegistry for a different type."); } - return_code_MonitoringTopics = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MonitoringTopics", type_ids_MonitoringTopics); - if (return_code_MonitoringTopics != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MonitoringTopics: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp index fe2e4e2b..29a602bf 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp @@ -80,28 +80,28 @@ eprosima::fastdds::dds::DynamicType::_ref_type get_dynamic_type( // traitstype_object_registry().get_type_information( + eprosima::fastdds::dds::xtypes::TypeInformation type_information; + if (eprosima::fastdds::dds::RETCODE_OK != eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( type_name, type_information)) { return nullptr; } - fastdds::dds::xtypes::TypeIdentifier type_id; + eprosima::fastdds::dds::xtypes::TypeIdentifier type_id; type_id = type_information.complete().typeid_with_size().type_id(); - fastdds::dds::xtypes::TypeObject type_obj; - if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( + eprosima::fastdds::dds::xtypes::TypeObject type_obj; + if (eprosima::fastdds::dds::RETCODE_OK == eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( type_id, type_obj)) + { + return eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(type_obj)->build(); } else { throw eprosima::utils::InconsistencyException("No Type Object"); } - - return eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(type_objects.complete_type_object)->build(); } } /* namespace test */ diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index 48bb350f..02bb20c0 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +// #include // #include #include @@ -41,16 +41,16 @@ XmlParticipant::XmlParticipant( : CommonParticipant(participant_configuration, payload_pool, discovery_database) , xml_specific_configuration_(*reinterpret_cast(configuration_.get())) { - if (xml_specific_configuration_.participant_profile.is_set()) - { - fastdds::dds::DomainParticipantExtendedQos extended_qos; - if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( - xml_specific_configuration_.participant_profile.get_value(), - extended_qos)) - { - configuration_->domain = extended_qos.domainId(); - } - } + // if (xml_specific_configuration_.participant_profile.is_set()) + // { + // fastdds::dds::DomainParticipantExtendedQos extended_qos; + // if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( + // xml_specific_configuration_.participant_profile.get_value(), + // extended_qos)) + // { + // configuration_->domain = extended_qos.domainId(); + // } + // } } std::shared_ptr XmlParticipant::create_writer( From b3fa7e7a2fb4984465c5c37efa05aa926e4ab6f8 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Wed, 29 May 2024 08:21:23 +0200 Subject: [PATCH 06/53] Add TypeIdentifiers to DdsTopic in order to pass the TypeInformation to RTPS Writer/Reader Signed-off-by: Lucia Echevarria --- .../ddspipe_core/types/topic/dds/DdsTopic.hpp | 5 +++++ ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp | 1 + .../src/cpp/reader/rtps/CommonReader.cpp | 11 +++++++++++ ddspipe_participants/src/cpp/utils/utils.cpp | 4 ++++ .../src/cpp/writer/rtps/CommonWriter.cpp | 12 +++++++++++- 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp index a65b2caa..b86c3a0d 100644 --- a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp +++ b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp @@ -17,6 +17,8 @@ #include #include +#include + #include #include @@ -85,6 +87,9 @@ struct DdsTopic : public DistributedTopic //! Topic Type name std::string type_name{}; + + //! Type Identifiers (complete and minimal) + fastdds::dds::xtypes::TypeIdentifierPair type_ids; }; } /* namespace types */ diff --git a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp index b30b404f..346e4d18 100644 --- a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp +++ b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp @@ -121,6 +121,7 @@ DdsTopic& DdsTopic::operator = ( Topic::operator =(other); this->type_name = other.type_name; + this->type_ids = other.type_ids; return *this; } diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 3551795a..c844a06f 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -15,6 +15,8 @@ #include #include +#include + #include #include #include @@ -349,6 +351,15 @@ fastrtps::TopicAttributes CommonReader::reckon_topic_attributes_( att.historyQos.kind = eprosima::fastdds::dds::HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS; att.historyQos.depth = topic.topic_qos.history_depth; + // Set TypeInformation of the discovered type + fastdds::dds::xtypes::TypeInformation type_info; + if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( + topic.type_ids, + type_info)) + { + att.type_information = type_info; + } + return att; } diff --git a/ddspipe_participants/src/cpp/utils/utils.cpp b/ddspipe_participants/src/cpp/utils/utils.cpp index b163f0ce..ffaba6a9 100644 --- a/ddspipe_participants/src/cpp/utils/utils.cpp +++ b/ddspipe_participants/src/cpp/utils/utils.cpp @@ -61,6 +61,10 @@ core::types::Endpoint create_common_endpoint_from_info_( // Set Topic key endpoint.topic.topic_qos.keyed.set_value(info.info.topicKind() == eprosima::fastrtps::rtps::TopicKind_t::WITH_KEY); + // Set TypeIdentifier + endpoint.topic.type_ids.type_identifier1(info.info.type_information().type_information.complete().typeid_with_size().type_id()); + endpoint.topic.type_ids.type_identifier2(info.info.type_information().type_information.minimal().typeid_with_size().type_id()); + // Parse Topic core::types::DdsTopic info_topic; endpoint.topic.m_topic_name = std::string(info.info.topicName()); diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 34ec0541..908d2df5 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. - #include #include #include +#include + #include #include #include @@ -401,6 +402,15 @@ fastrtps::TopicAttributes CommonWriter::reckon_topic_attributes_( att.topicName = topic.m_topic_name; att.topicDataType = topic.type_name; + // Set TypeInformation of the discovered type + fastdds::dds::xtypes::TypeInformation type_info; + if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( + topic.type_ids, + type_info)) + { + att.type_information = type_info; + } + return att; } From df5125e17aa63147eb072c42260c8811acf7df17 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 3 Jun 2024 15:28:20 +0200 Subject: [PATCH 07/53] Apply suggested changes Signed-off-by: Lucia Echevarria --- .../include/ddspipe_core/types/dds/Guid.hpp | 2 +- .../ddspipe_core/types/topic/dds/DdsTopic.hpp | 3 + .../cpp/types/logging/LogEntryPubSubTypes.cxx | 3 +- .../logging/LogEntryTypeObjectSupport.cxx | 327 +++------- .../status/MonitoringStatusPubSubTypes.cxx | 6 +- .../MonitoringStatusTypeObjectSupport.cxx | 184 +----- .../topics/MonitoringTopicsPubSubTypes.cxx | 9 +- .../MonitoringTopicsTypeObjectSupport.cxx | 594 ++---------------- .../src/cpp/types/topic/dds/DdsTopic.cpp | 6 + .../test/unittest/types/endpoint/GuidTest.cpp | 2 +- .../participant/rtps/CommonParticipant.hpp | 6 +- .../reader/rtps/CommonReader.hpp | 20 +- .../types/dds/TopicDataType.hpp | 5 +- .../ddspipe_participants/utils/utils.hpp | 2 +- .../writer/rpc/SimpleWriter.hpp | 10 +- .../writer/rtps/CommonWriter.hpp | 18 +- .../writer/rtps/QoSSpecificWriter.hpp | 2 +- .../writer/rtps/SimpleWriter.hpp | 10 +- .../cpp/participant/dds/CommonParticipant.cpp | 3 +- .../cpp/participant/dds/XmlParticipant.cpp | 20 +- .../dynamic_types/DynTypesParticipant.cpp | 4 +- .../participant/rtps/CommonParticipant.cpp | 4 +- .../participant/rtps/SimpleParticipant.cpp | 4 +- .../src/cpp/reader/dds/CommonReader.cpp | 3 +- .../src/cpp/reader/dds/SimpleReader.cpp | 4 +- .../src/cpp/reader/dds/SpecificQoSReader.cpp | 4 +- .../src/cpp/reader/rpc/SimpleReader.cpp | 4 +- .../src/cpp/reader/rtps/CommonReader.cpp | 12 +- .../src/cpp/reader/rtps/SimpleReader.cpp | 4 +- .../src/cpp/reader/rtps/SpecificQoSReader.cpp | 4 +- .../src/cpp/types/dds/TopicDataType.cpp | 7 +- .../src/cpp/writer/dds/CommonWriter.cpp | 6 +- .../src/cpp/writer/dds/MultiWriter.cpp | 6 +- .../src/cpp/writer/dds/SimpleWriter.cpp | 6 +- .../src/cpp/writer/rpc/SimpleWriter.cpp | 6 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 14 +- .../src/cpp/writer/rtps/MultiWriter.cpp | 6 +- .../src/cpp/writer/rtps/QoSSpecificWriter.cpp | 4 +- .../src/cpp/writer/rtps/SimpleWriter.cpp | 6 +- .../writer/rtps/filter/RepeaterDataFilter.cpp | 4 +- .../cpp/writer/rtps/filter/SelfDataFilter.cpp | 4 +- 41 files changed, 267 insertions(+), 1081 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp index 053adf6c..a960ee8d 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp @@ -14,7 +14,7 @@ #pragma once -#include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp index b86c3a0d..f4a3485d 100644 --- a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp +++ b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp @@ -81,6 +81,9 @@ struct DdsTopic : public DistributedTopic const std::string& type_name, utils::Formatter& error_msg) noexcept; + void set_type_ids( + const fastdds::dds::xtypes::TypeIdentifierPair& _type_ids) noexcept; + ///////////////////////// // VARIABLES ///////////////////////// diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx index a769a800..b1a5c9d5 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx @@ -221,8 +221,7 @@ bool LogEntryPubSubType::getKey( void LogEntryPubSubType::register_type_object_representation() { - eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; - register_LogEntry_type_identifier(type_ids); + register_LogEntry_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx index d0527c95..868bc39e 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx @@ -41,52 +41,59 @@ using namespace eprosima::fastdds::dds::xtypes; void register_Kind_type_identifier( TypeIdentifierPair& type_ids_Kind) { - EnumTypeFlag enum_flags_Kind = 0; - BitBound bit_bound_Kind = 32; - CommonEnumeratedHeader common_Kind = TypeObjectUtils::build_common_enumerated_header(bit_bound_Kind); - QualifiedTypeName type_name_Kind = "Kind"; - eprosima::fastcdr::optional type_ann_builtin_Kind; - eprosima::fastcdr::optional ann_custom_Kind; - CompleteTypeDetail detail_Kind = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Kind, ann_custom_Kind, type_name_Kind.to_string()); - CompleteEnumeratedHeader header_Kind = TypeObjectUtils::build_complete_enumerated_header(common_Kind, detail_Kind); - CompleteEnumeratedLiteralSeq literal_seq_Kind; - { - EnumeratedLiteralFlag flags_Info = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_Info = TypeObjectUtils::build_common_enumerated_literal(0, flags_Info); - eprosima::fastcdr::optional member_ann_builtin_Info; - ann_custom_Kind.reset(); - MemberName name_Info = "Info"; - CompleteMemberDetail detail_Info = TypeObjectUtils::build_complete_member_detail(name_Info, member_ann_builtin_Info, ann_custom_Kind); - CompleteEnumeratedLiteral literal_Info = TypeObjectUtils::build_complete_enumerated_literal(common_Info, detail_Info); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Info); - } - { - EnumeratedLiteralFlag flags_Warning = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_Warning = TypeObjectUtils::build_common_enumerated_literal(1, flags_Warning); - eprosima::fastcdr::optional member_ann_builtin_Warning; - ann_custom_Kind.reset(); - MemberName name_Warning = "Warning"; - CompleteMemberDetail detail_Warning = TypeObjectUtils::build_complete_member_detail(name_Warning, member_ann_builtin_Warning, ann_custom_Kind); - CompleteEnumeratedLiteral literal_Warning = TypeObjectUtils::build_complete_enumerated_literal(common_Warning, detail_Warning); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Warning); - } - { - EnumeratedLiteralFlag flags_Error = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_Error = TypeObjectUtils::build_common_enumerated_literal(2, flags_Error); - eprosima::fastcdr::optional member_ann_builtin_Error; - ann_custom_Kind.reset(); - MemberName name_Error = "Error"; - CompleteMemberDetail detail_Error = TypeObjectUtils::build_complete_member_detail(name_Error, member_ann_builtin_Error, ann_custom_Kind); - CompleteEnumeratedLiteral literal_Error = TypeObjectUtils::build_complete_enumerated_literal(common_Error, detail_Error); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Error); - } - CompleteEnumeratedType enumerated_type_Kind = TypeObjectUtils::build_complete_enumerated_type(enum_flags_Kind, header_Kind, - literal_seq_Kind); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_Kind, type_name_Kind.to_string(), type_ids_Kind)) + ReturnCode_t return_code_Kind {eprosima::fastdds::dds::RETCODE_OK}; + return_code_Kind = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "Kind", type_ids_Kind); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Kind) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Kind already registered in TypeObjectRegistry for a different type."); + EnumTypeFlag enum_flags_Kind = 0; + BitBound bit_bound_Kind = 32; + CommonEnumeratedHeader common_Kind = TypeObjectUtils::build_common_enumerated_header(bit_bound_Kind); + QualifiedTypeName type_name_Kind = "Kind"; + eprosima::fastcdr::optional type_ann_builtin_Kind; + eprosima::fastcdr::optional ann_custom_Kind; + CompleteTypeDetail detail_Kind = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Kind, ann_custom_Kind, type_name_Kind.to_string()); + CompleteEnumeratedHeader header_Kind = TypeObjectUtils::build_complete_enumerated_header(common_Kind, detail_Kind); + CompleteEnumeratedLiteralSeq literal_seq_Kind; + { + EnumeratedLiteralFlag flags_Info = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Info = TypeObjectUtils::build_common_enumerated_literal(0, flags_Info); + eprosima::fastcdr::optional member_ann_builtin_Info; + ann_custom_Kind.reset(); + MemberName name_Info = "Info"; + CompleteMemberDetail detail_Info = TypeObjectUtils::build_complete_member_detail(name_Info, member_ann_builtin_Info, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Info = TypeObjectUtils::build_complete_enumerated_literal(common_Info, detail_Info); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Info); + } + { + EnumeratedLiteralFlag flags_Warning = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Warning = TypeObjectUtils::build_common_enumerated_literal(1, flags_Warning); + eprosima::fastcdr::optional member_ann_builtin_Warning; + ann_custom_Kind.reset(); + MemberName name_Warning = "Warning"; + CompleteMemberDetail detail_Warning = TypeObjectUtils::build_complete_member_detail(name_Warning, member_ann_builtin_Warning, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Warning = TypeObjectUtils::build_complete_enumerated_literal(common_Warning, detail_Warning); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Warning); + } + { + EnumeratedLiteralFlag flags_Error = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_Error = TypeObjectUtils::build_common_enumerated_literal(2, flags_Error); + eprosima::fastcdr::optional member_ann_builtin_Error; + ann_custom_Kind.reset(); + MemberName name_Error = "Error"; + CompleteMemberDetail detail_Error = TypeObjectUtils::build_complete_member_detail(name_Error, member_ann_builtin_Error, ann_custom_Kind); + CompleteEnumeratedLiteral literal_Error = TypeObjectUtils::build_complete_enumerated_literal(common_Error, detail_Error); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_Kind, literal_Error); + } + CompleteEnumeratedType enumerated_type_Kind = TypeObjectUtils::build_complete_enumerated_type(enum_flags_Kind, header_Kind, + literal_seq_Kind); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_Kind, type_name_Kind.to_string(), type_ids_Kind)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Kind already registered in TypeObjectRegistry for a different type."); + } } }// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method void register_LogEntry_type_identifier( @@ -124,50 +131,12 @@ void register_LogEntry_type_identifier( } StructMemberFlag member_flags_event = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, true, false); - CommonStructMember common_event; MemberId member_id_event = 0x00000000; - if (EK_COMPLETE == type_ids_event.type_identifier1()._d() || TK_NONE == type_ids_event.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_event.type_identifier1()._d() && - EK_COMPLETE == type_ids_event.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_event.type_identifier1()._d() && - EK_COMPLETE == type_ids_event.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_event.type_identifier1()._d() && - EK_COMPLETE == type_ids_event.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_event.type_identifier1()._d() && - EK_COMPLETE == type_ids_event.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_event.type_identifier1()._d() && - (EK_COMPLETE == type_ids_event.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_event.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_event.type_identifier1()._d() && - (EK_COMPLETE == type_ids_event.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_event.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_event = TypeObjectUtils::build_common_struct_member(member_id_event, - member_flags_event, type_ids_event.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_event.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_event.type_identifier2()._d() && - EK_COMPLETE == type_ids_event.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_event.type_identifier2()._d() && - EK_COMPLETE == type_ids_event.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_event.type_identifier2()._d() && - EK_COMPLETE == type_ids_event.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_event.type_identifier2()._d() && - EK_COMPLETE == type_ids_event.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_event.type_identifier2()._d() && - (EK_COMPLETE == type_ids_event.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_event.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_event.type_identifier2()._d() && - (EK_COMPLETE == type_ids_event.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_event.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_event = TypeObjectUtils::build_common_struct_member(member_id_event, - member_flags_event, type_ids_event.type_identifier2()); - } - else + bool common_event_ec {false}; + CommonStructMember common_event {TypeObjectUtils::build_common_struct_member(member_id_event, member_flags_event, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_event, common_event_ec))}; + if (!common_event_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure event member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure event member TypeIdentifier inconsistent."); return; } MemberName name_event = "event"; @@ -203,50 +172,12 @@ void register_LogEntry_type_identifier( } StructMemberFlag member_flags_kind = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_kind; MemberId member_id_kind = 0x00000001; - if (EK_COMPLETE == type_ids_kind.type_identifier1()._d() || TK_NONE == type_ids_kind.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_kind.type_identifier1()._d() && - EK_COMPLETE == type_ids_kind.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_kind.type_identifier1()._d() && - EK_COMPLETE == type_ids_kind.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_kind.type_identifier1()._d() && - EK_COMPLETE == type_ids_kind.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_kind.type_identifier1()._d() && - EK_COMPLETE == type_ids_kind.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_kind.type_identifier1()._d() && - (EK_COMPLETE == type_ids_kind.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_kind.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_kind.type_identifier1()._d() && - (EK_COMPLETE == type_ids_kind.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_kind.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, - member_flags_kind, type_ids_kind.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_kind.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_kind.type_identifier2()._d() && - EK_COMPLETE == type_ids_kind.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_kind.type_identifier2()._d() && - EK_COMPLETE == type_ids_kind.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_kind.type_identifier2()._d() && - EK_COMPLETE == type_ids_kind.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_kind.type_identifier2()._d() && - EK_COMPLETE == type_ids_kind.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_kind.type_identifier2()._d() && - (EK_COMPLETE == type_ids_kind.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_kind.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_kind.type_identifier2()._d() && - (EK_COMPLETE == type_ids_kind.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_kind.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_kind_ec {false}; + CommonStructMember common_kind {TypeObjectUtils::build_common_struct_member(member_id_kind, member_flags_kind, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_kind, common_kind_ec))}; + if (!common_kind_ec) { - common_kind = TypeObjectUtils::build_common_struct_member(member_id_kind, - member_flags_kind, type_ids_kind.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure kind member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure kind member TypeIdentifier inconsistent."); return; } MemberName name_kind = "kind"; @@ -279,50 +210,12 @@ void register_LogEntry_type_identifier( } StructMemberFlag member_flags_category = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_category; MemberId member_id_category = 0x00000002; - if (EK_COMPLETE == type_ids_category.type_identifier1()._d() || TK_NONE == type_ids_category.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_category.type_identifier1()._d() && - EK_COMPLETE == type_ids_category.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_category.type_identifier1()._d() && - EK_COMPLETE == type_ids_category.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_category.type_identifier1()._d() && - EK_COMPLETE == type_ids_category.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_category.type_identifier1()._d() && - EK_COMPLETE == type_ids_category.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_category.type_identifier1()._d() && - (EK_COMPLETE == type_ids_category.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_category.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_category.type_identifier1()._d() && - (EK_COMPLETE == type_ids_category.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_category.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_category_ec {false}; + CommonStructMember common_category {TypeObjectUtils::build_common_struct_member(member_id_category, member_flags_category, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_category, common_category_ec))}; + if (!common_category_ec) { - common_category = TypeObjectUtils::build_common_struct_member(member_id_category, - member_flags_category, type_ids_category.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_category.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_category.type_identifier2()._d() && - EK_COMPLETE == type_ids_category.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_category.type_identifier2()._d() && - EK_COMPLETE == type_ids_category.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_category.type_identifier2()._d() && - EK_COMPLETE == type_ids_category.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_category.type_identifier2()._d() && - EK_COMPLETE == type_ids_category.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_category.type_identifier2()._d() && - (EK_COMPLETE == type_ids_category.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_category.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_category.type_identifier2()._d() && - (EK_COMPLETE == type_ids_category.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_category.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_category = TypeObjectUtils::build_common_struct_member(member_id_category, - member_flags_category, type_ids_category.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure category member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure category member TypeIdentifier inconsistent."); return; } MemberName name_category = "category"; @@ -355,50 +248,12 @@ void register_LogEntry_type_identifier( } StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_message; MemberId member_id_message = 0x00000003; - if (EK_COMPLETE == type_ids_message.type_identifier1()._d() || TK_NONE == type_ids_message.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_message.type_identifier1()._d() && - EK_COMPLETE == type_ids_message.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_message.type_identifier1()._d() && - EK_COMPLETE == type_ids_message.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_message.type_identifier1()._d() && - EK_COMPLETE == type_ids_message.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_message.type_identifier1()._d() && - EK_COMPLETE == type_ids_message.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_message.type_identifier1()._d() && - (EK_COMPLETE == type_ids_message.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_message.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_message.type_identifier1()._d() && - (EK_COMPLETE == type_ids_message.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_message.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_message_ec {false}; + CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))}; + if (!common_message_ec) { - common_message = TypeObjectUtils::build_common_struct_member(member_id_message, - member_flags_message, type_ids_message.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_message.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_message.type_identifier2()._d() && - EK_COMPLETE == type_ids_message.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_message.type_identifier2()._d() && - EK_COMPLETE == type_ids_message.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_message.type_identifier2()._d() && - EK_COMPLETE == type_ids_message.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_message.type_identifier2()._d() && - EK_COMPLETE == type_ids_message.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_message.type_identifier2()._d() && - (EK_COMPLETE == type_ids_message.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_message.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_message.type_identifier2()._d() && - (EK_COMPLETE == type_ids_message.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_message.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_message = TypeObjectUtils::build_common_struct_member(member_id_message, - member_flags_message, type_ids_message.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure message member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent."); return; } MemberName name_message = "message"; @@ -431,50 +286,12 @@ void register_LogEntry_type_identifier( } StructMemberFlag member_flags_timestamp = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_timestamp; MemberId member_id_timestamp = 0x00000004; - if (EK_COMPLETE == type_ids_timestamp.type_identifier1()._d() || TK_NONE == type_ids_timestamp.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_timestamp.type_identifier1()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_timestamp.type_identifier1()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_timestamp.type_identifier1()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_timestamp.type_identifier1()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_timestamp.type_identifier1()._d() && - (EK_COMPLETE == type_ids_timestamp.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_timestamp.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_timestamp.type_identifier1()._d() && - (EK_COMPLETE == type_ids_timestamp.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_timestamp.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_timestamp_ec {false}; + CommonStructMember common_timestamp {TypeObjectUtils::build_common_struct_member(member_id_timestamp, member_flags_timestamp, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_timestamp, common_timestamp_ec))}; + if (!common_timestamp_ec) { - common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, - member_flags_timestamp, type_ids_timestamp.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_timestamp.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_timestamp.type_identifier2()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_timestamp.type_identifier2()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_timestamp.type_identifier2()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_timestamp.type_identifier2()._d() && - EK_COMPLETE == type_ids_timestamp.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_timestamp.type_identifier2()._d() && - (EK_COMPLETE == type_ids_timestamp.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_timestamp.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_timestamp.type_identifier2()._d() && - (EK_COMPLETE == type_ids_timestamp.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_timestamp.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_timestamp = TypeObjectUtils::build_common_struct_member(member_id_timestamp, - member_flags_timestamp, type_ids_timestamp.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure timestamp member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure timestamp member TypeIdentifier inconsistent."); return; } MemberName name_timestamp = "timestamp"; diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx index d6568bf0..608e0dde 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx @@ -221,8 +221,7 @@ bool MonitoringErrorStatusPubSubType::getKey( void MonitoringErrorStatusPubSubType::register_type_object_representation() { - eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; - register_MonitoringErrorStatus_type_identifier(type_ids); + register_MonitoringErrorStatus_type_identifier(type_identifiers_); } MonitoringStatusPubSubType::MonitoringStatusPubSubType() @@ -415,8 +414,7 @@ bool MonitoringStatusPubSubType::getKey( void MonitoringStatusPubSubType::register_type_object_representation() { - eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; - register_MonitoringStatus_type_identifier(type_ids); + register_MonitoringStatus_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx index f99fba42..f6452e94 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx @@ -74,50 +74,12 @@ void register_MonitoringErrorStatus_type_identifier( } StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_type_mismatch; MemberId member_id_type_mismatch = 0x00000000; - if (EK_COMPLETE == type_ids_type_mismatch.type_identifier1()._d() || TK_NONE == type_ids_type_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_type_mismatch_ec {false}; + CommonStructMember common_type_mismatch {TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_type_mismatch, common_type_mismatch_ec))}; + if (!common_type_mismatch_ec) { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, - member_flags_type_mismatch, type_ids_type_mismatch.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_type_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, - member_flags_type_mismatch, type_ids_type_mismatch.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_mismatch member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure type_mismatch member TypeIdentifier inconsistent."); return; } MemberName name_type_mismatch = "type_mismatch"; @@ -142,50 +104,12 @@ void register_MonitoringErrorStatus_type_identifier( } StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_qos_mismatch; MemberId member_id_qos_mismatch = 0x00000001; - if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1()._d() || TK_NONE == type_ids_qos_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_qos_mismatch_ec {false}; + CommonStructMember common_qos_mismatch {TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_qos_mismatch, common_qos_mismatch_ec))}; + if (!common_qos_mismatch_ec) { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, - member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, - member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure qos_mismatch member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure qos_mismatch member TypeIdentifier inconsistent."); return; } MemberName name_qos_mismatch = "qos_mismatch"; @@ -238,50 +162,12 @@ void register_MonitoringStatus_type_identifier( } StructMemberFlag member_flags_error_status = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_error_status; MemberId member_id_error_status = 0x00000000; - if (EK_COMPLETE == type_ids_error_status.type_identifier1()._d() || TK_NONE == type_ids_error_status.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_error_status.type_identifier1()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_error_status.type_identifier1()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_error_status.type_identifier1()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_error_status.type_identifier1()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_error_status.type_identifier1()._d() && - (EK_COMPLETE == type_ids_error_status.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_error_status.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_error_status.type_identifier1()._d() && - (EK_COMPLETE == type_ids_error_status.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_error_status.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_error_status_ec {false}; + CommonStructMember common_error_status {TypeObjectUtils::build_common_struct_member(member_id_error_status, member_flags_error_status, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_error_status, common_error_status_ec))}; + if (!common_error_status_ec) { - common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, - member_flags_error_status, type_ids_error_status.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_error_status.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_error_status.type_identifier2()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_error_status.type_identifier2()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_error_status.type_identifier2()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_error_status.type_identifier2()._d() && - EK_COMPLETE == type_ids_error_status.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_error_status.type_identifier2()._d() && - (EK_COMPLETE == type_ids_error_status.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_error_status.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_error_status.type_identifier2()._d() && - (EK_COMPLETE == type_ids_error_status.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_error_status.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_error_status = TypeObjectUtils::build_common_struct_member(member_id_error_status, - member_flags_error_status, type_ids_error_status.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure error_status member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure error_status member TypeIdentifier inconsistent."); return; } MemberName name_error_status = "error_status"; @@ -306,50 +192,12 @@ void register_MonitoringStatus_type_identifier( } StructMemberFlag member_flags_has_errors = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_has_errors; MemberId member_id_has_errors = 0x00000001; - if (EK_COMPLETE == type_ids_has_errors.type_identifier1()._d() || TK_NONE == type_ids_has_errors.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_has_errors.type_identifier1()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_has_errors.type_identifier1()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_has_errors.type_identifier1()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_has_errors.type_identifier1()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_has_errors.type_identifier1()._d() && - (EK_COMPLETE == type_ids_has_errors.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_has_errors.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_has_errors.type_identifier1()._d() && - (EK_COMPLETE == type_ids_has_errors.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_has_errors.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_has_errors_ec {false}; + CommonStructMember common_has_errors {TypeObjectUtils::build_common_struct_member(member_id_has_errors, member_flags_has_errors, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_has_errors, common_has_errors_ec))}; + if (!common_has_errors_ec) { - common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, - member_flags_has_errors, type_ids_has_errors.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_has_errors.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_has_errors.type_identifier2()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_has_errors.type_identifier2()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_has_errors.type_identifier2()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_has_errors.type_identifier2()._d() && - EK_COMPLETE == type_ids_has_errors.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_has_errors.type_identifier2()._d() && - (EK_COMPLETE == type_ids_has_errors.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_has_errors.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_has_errors.type_identifier2()._d() && - (EK_COMPLETE == type_ids_has_errors.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_has_errors.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_has_errors = TypeObjectUtils::build_common_struct_member(member_id_has_errors, - member_flags_has_errors, type_ids_has_errors.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure has_errors member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure has_errors member TypeIdentifier inconsistent."); return; } MemberName name_has_errors = "has_errors"; diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx index a1198206..d545020d 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx @@ -221,8 +221,7 @@ bool DdsTopicDataPubSubType::getKey( void DdsTopicDataPubSubType::register_type_object_representation() { - eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; - register_DdsTopicData_type_identifier(type_ids); + register_DdsTopicData_type_identifier(type_identifiers_); } DdsTopicPubSubType::DdsTopicPubSubType() @@ -415,8 +414,7 @@ bool DdsTopicPubSubType::getKey( void DdsTopicPubSubType::register_type_object_representation() { - eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; - register_DdsTopic_type_identifier(type_ids); + register_DdsTopic_type_identifier(type_identifiers_); } MonitoringTopicsPubSubType::MonitoringTopicsPubSubType() @@ -609,8 +607,7 @@ bool MonitoringTopicsPubSubType::getKey( void MonitoringTopicsPubSubType::register_type_object_representation() { - eprosima::fastdds::dds::xtypes::TypeIdentifierPair type_ids; - register_MonitoringTopics_type_identifier(type_ids); + register_MonitoringTopics_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx index 0e57c309..7ff982ae 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx @@ -82,50 +82,12 @@ void register_DdsTopicData_type_identifier( } StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_participant_id; MemberId member_id_participant_id = 0x00000000; - if (EK_COMPLETE == type_ids_participant_id.type_identifier1()._d() || TK_NONE == type_ids_participant_id.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_participant_id.type_identifier1()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_participant_id.type_identifier1()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_participant_id.type_identifier1()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_participant_id.type_identifier1()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_participant_id.type_identifier1()._d() && - (EK_COMPLETE == type_ids_participant_id.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_participant_id.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_participant_id.type_identifier1()._d() && - (EK_COMPLETE == type_ids_participant_id.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_participant_id.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_participant_id_ec {false}; + CommonStructMember common_participant_id {TypeObjectUtils::build_common_struct_member(member_id_participant_id, member_flags_participant_id, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_participant_id, common_participant_id_ec))}; + if (!common_participant_id_ec) { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, - member_flags_participant_id, type_ids_participant_id.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_participant_id.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_participant_id.type_identifier2()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_participant_id.type_identifier2()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_participant_id.type_identifier2()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_participant_id.type_identifier2()._d() && - EK_COMPLETE == type_ids_participant_id.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_participant_id.type_identifier2()._d() && - (EK_COMPLETE == type_ids_participant_id.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_participant_id.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_participant_id.type_identifier2()._d() && - (EK_COMPLETE == type_ids_participant_id.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_participant_id.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_participant_id = TypeObjectUtils::build_common_struct_member(member_id_participant_id, - member_flags_participant_id, type_ids_participant_id.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure participant_id member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure participant_id member TypeIdentifier inconsistent."); return; } MemberName name_participant_id = "participant_id"; @@ -150,50 +112,12 @@ void register_DdsTopicData_type_identifier( } StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_msgs_lost; MemberId member_id_msgs_lost = 0x00000001; - if (EK_COMPLETE == type_ids_msgs_lost.type_identifier1()._d() || TK_NONE == type_ids_msgs_lost.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_lost.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_lost.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_lost.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_lost.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_msgs_lost.type_identifier1()._d() && - (EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_msgs_lost.type_identifier1()._d() && - (EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_lost.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, - member_flags_msgs_lost, type_ids_msgs_lost.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_msgs_lost.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_lost.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_lost.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_lost.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_lost.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_lost.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_msgs_lost.type_identifier2()._d() && - (EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_msgs_lost.type_identifier2()._d() && - (EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_lost.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msgs_lost = TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, - member_flags_msgs_lost, type_ids_msgs_lost.type_identifier2()); - } - else + bool common_msgs_lost_ec {false}; + CommonStructMember common_msgs_lost {TypeObjectUtils::build_common_struct_member(member_id_msgs_lost, member_flags_msgs_lost, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_msgs_lost, common_msgs_lost_ec))}; + if (!common_msgs_lost_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msgs_lost member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure msgs_lost member TypeIdentifier inconsistent."); return; } MemberName name_msgs_lost = "msgs_lost"; @@ -218,50 +142,12 @@ void register_DdsTopicData_type_identifier( } StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_msgs_received; MemberId member_id_msgs_received = 0x00000002; - if (EK_COMPLETE == type_ids_msgs_received.type_identifier1()._d() || TK_NONE == type_ids_msgs_received.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_received.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_received.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_received.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_received.type_identifier1()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_msgs_received.type_identifier1()._d() && - (EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_msgs_received.type_identifier1()._d() && - (EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_received.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, - member_flags_msgs_received, type_ids_msgs_received.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_msgs_received.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_msgs_received.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_msgs_received.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_msgs_received.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_msgs_received.type_identifier2()._d() && - EK_COMPLETE == type_ids_msgs_received.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_msgs_received.type_identifier2()._d() && - (EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_msgs_received.type_identifier2()._d() && - (EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msgs_received.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_msgs_received_ec {false}; + CommonStructMember common_msgs_received {TypeObjectUtils::build_common_struct_member(member_id_msgs_received, member_flags_msgs_received, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_msgs_received, common_msgs_received_ec))}; + if (!common_msgs_received_ec) { - common_msgs_received = TypeObjectUtils::build_common_struct_member(member_id_msgs_received, - member_flags_msgs_received, type_ids_msgs_received.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msgs_received member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure msgs_received member TypeIdentifier inconsistent."); return; } MemberName name_msgs_received = "msgs_received"; @@ -286,50 +172,12 @@ void register_DdsTopicData_type_identifier( } StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_msg_rx_rate; MemberId member_id_msg_rx_rate = 0x00000003; - if (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1()._d() || TK_NONE == type_ids_msg_rx_rate.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_msg_rx_rate.type_identifier1()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_msg_rx_rate.type_identifier1()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_msg_rx_rate.type_identifier1()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_msg_rx_rate.type_identifier1()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_msg_rx_rate.type_identifier1()._d() && - (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_msg_rx_rate.type_identifier1()._d() && - (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, - member_flags_msg_rx_rate, type_ids_msg_rx_rate.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_msg_rx_rate.type_identifier2()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_msg_rx_rate.type_identifier2()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_msg_rx_rate.type_identifier2()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_msg_rx_rate.type_identifier2()._d() && - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_msg_rx_rate.type_identifier2()._d() && - (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_msg_rx_rate.type_identifier2()._d() && - (EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_msg_rx_rate.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_msg_rx_rate = TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, - member_flags_msg_rx_rate, type_ids_msg_rx_rate.type_identifier2()); - } - else + bool common_msg_rx_rate_ec {false}; + CommonStructMember common_msg_rx_rate {TypeObjectUtils::build_common_struct_member(member_id_msg_rx_rate, member_flags_msg_rx_rate, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_msg_rx_rate, common_msg_rx_rate_ec))}; + if (!common_msg_rx_rate_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure msg_rx_rate member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure msg_rx_rate member TypeIdentifier inconsistent."); return; } MemberName name_msg_rx_rate = "msg_rx_rate"; @@ -392,50 +240,12 @@ void register_DdsTopic_type_identifier( } StructMemberFlag member_flags_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_name; MemberId member_id_name = 0x00000000; - if (EK_COMPLETE == type_ids_name.type_identifier1()._d() || TK_NONE == type_ids_name.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_name.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_name.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_name.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_name.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_name.type_identifier1()._d() && - (EK_COMPLETE == type_ids_name.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_name.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_name.type_identifier1()._d() && - (EK_COMPLETE == type_ids_name.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_name.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_name = TypeObjectUtils::build_common_struct_member(member_id_name, - member_flags_name, type_ids_name.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_name.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_name.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_name.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_name.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_name.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_name.type_identifier2()._d() && - (EK_COMPLETE == type_ids_name.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_name.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_name.type_identifier2()._d() && - (EK_COMPLETE == type_ids_name.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_name.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_name = TypeObjectUtils::build_common_struct_member(member_id_name, - member_flags_name, type_ids_name.type_identifier2()); - } - else + bool common_name_ec {false}; + CommonStructMember common_name {TypeObjectUtils::build_common_struct_member(member_id_name, member_flags_name, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_name, common_name_ec))}; + if (!common_name_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure name member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure name member TypeIdentifier inconsistent."); return; } MemberName name_name = "name"; @@ -468,50 +278,12 @@ void register_DdsTopic_type_identifier( } StructMemberFlag member_flags_type_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_type_name; MemberId member_id_type_name = 0x00000001; - if (EK_COMPLETE == type_ids_type_name.type_identifier1()._d() || TK_NONE == type_ids_type_name.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_name.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_name.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_name.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_name.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_name.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_name.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_name.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, - member_flags_type_name, type_ids_type_name.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_type_name.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_name.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_name.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_name.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_name.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_name.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_name.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_name.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_name.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_type_name = TypeObjectUtils::build_common_struct_member(member_id_type_name, - member_flags_type_name, type_ids_type_name.type_identifier2()); - } - else + bool common_type_name_ec {false}; + CommonStructMember common_type_name {TypeObjectUtils::build_common_struct_member(member_id_type_name, member_flags_type_name, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_type_name, common_type_name_ec))}; + if (!common_type_name_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_name member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure type_name member TypeIdentifier inconsistent."); return; } MemberName name_type_name = "type_name"; @@ -536,50 +308,12 @@ void register_DdsTopic_type_identifier( } StructMemberFlag member_flags_type_discovered = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_type_discovered; MemberId member_id_type_discovered = 0x00000002; - if (EK_COMPLETE == type_ids_type_discovered.type_identifier1()._d() || TK_NONE == type_ids_type_discovered.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_discovered.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_discovered.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_discovered.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_discovered.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_discovered.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_discovered.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_discovered.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, - member_flags_type_discovered, type_ids_type_discovered.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_type_discovered.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_discovered.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_discovered.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_discovered.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_discovered.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_discovered.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_discovered.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_discovered.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_discovered.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_type_discovered_ec {false}; + CommonStructMember common_type_discovered {TypeObjectUtils::build_common_struct_member(member_id_type_discovered, member_flags_type_discovered, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_type_discovered, common_type_discovered_ec))}; + if (!common_type_discovered_ec) { - common_type_discovered = TypeObjectUtils::build_common_struct_member(member_id_type_discovered, - member_flags_type_discovered, type_ids_type_discovered.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_discovered member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure type_discovered member TypeIdentifier inconsistent."); return; } MemberName name_type_discovered = "type_discovered"; @@ -604,50 +338,12 @@ void register_DdsTopic_type_identifier( } StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_type_mismatch; MemberId member_id_type_mismatch = 0x00000003; - if (EK_COMPLETE == type_ids_type_mismatch.type_identifier1()._d() || TK_NONE == type_ids_type_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, - member_flags_type_mismatch, type_ids_type_mismatch.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_type_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_type_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_type_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_type_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_type_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_type_mismatch = TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, - member_flags_type_mismatch, type_ids_type_mismatch.type_identifier2()); - } - else + bool common_type_mismatch_ec {false}; + CommonStructMember common_type_mismatch {TypeObjectUtils::build_common_struct_member(member_id_type_mismatch, member_flags_type_mismatch, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_type_mismatch, common_type_mismatch_ec))}; + if (!common_type_mismatch_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure type_mismatch member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure type_mismatch member TypeIdentifier inconsistent."); return; } MemberName name_type_mismatch = "type_mismatch"; @@ -672,50 +368,12 @@ void register_DdsTopic_type_identifier( } StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_qos_mismatch; MemberId member_id_qos_mismatch = 0x00000004; - if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1()._d() || TK_NONE == type_ids_qos_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier1()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_qos_mismatch_ec {false}; + CommonStructMember common_qos_mismatch {TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, member_flags_qos_mismatch, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_qos_mismatch, common_qos_mismatch_ec))}; + if (!common_qos_mismatch_ec) { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, - member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_qos_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_qos_mismatch.type_identifier2()._d() && - (EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_qos_mismatch.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_qos_mismatch = TypeObjectUtils::build_common_struct_member(member_id_qos_mismatch, - member_flags_qos_mismatch, type_ids_qos_mismatch.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure qos_mismatch member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure qos_mismatch member TypeIdentifier inconsistent."); return; } MemberName name_qos_mismatch = "qos_mismatch"; @@ -742,47 +400,11 @@ void register_DdsTopic_type_identifier( { ::register_DdsTopicData_type_identifier(type_ids_data); } - TypeIdentifier* element_identifier_anonymous_sequence_DdsTopicData_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_data.type_identifier1()._d() || TK_NONE == type_ids_data.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier1()._d() && - (EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier1()._d() && - (EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_data.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_data.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier2()._d() && - (EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier2()._d() && - (EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool element_identifier_anonymous_sequence_DdsTopicData_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_DdsTopicData_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_data, element_identifier_anonymous_sequence_DdsTopicData_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_DdsTopicData_unbounded_ec) { - element_identifier_anonymous_sequence_DdsTopicData_unbounded = new TypeIdentifier(type_ids_data.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_DdsTopicData_unbounded = EK_COMPLETE; @@ -806,50 +428,12 @@ void register_DdsTopic_type_identifier( } StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_data; MemberId member_id_data = 0x00000005; - if (EK_COMPLETE == type_ids_data.type_identifier1()._d() || TK_NONE == type_ids_data.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier1()._d() && - EK_COMPLETE == type_ids_data.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier1()._d() && - (EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier1()._d() && - (EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_data = TypeObjectUtils::build_common_struct_member(member_id_data, - member_flags_data, type_ids_data.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_data.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_data.type_identifier2()._d() && - EK_COMPLETE == type_ids_data.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_data.type_identifier2()._d() && - (EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_data.type_identifier2()._d() && - (EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_data.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_data = TypeObjectUtils::build_common_struct_member(member_id_data, - member_flags_data, type_ids_data.type_identifier2()); - } - else + bool common_data_ec {false}; + CommonStructMember common_data {TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_data, common_data_ec))}; + if (!common_data_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure data member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure data member TypeIdentifier inconsistent."); return; } MemberName name_data = "data"; @@ -906,47 +490,11 @@ void register_MonitoringTopics_type_identifier( { ::register_DdsTopic_type_identifier(type_ids_topics); } - TypeIdentifier* element_identifier_anonymous_sequence_DdsTopic_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_topics.type_identifier1()._d() || TK_NONE == type_ids_topics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_topics.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_topics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool element_identifier_anonymous_sequence_DdsTopic_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_DdsTopic_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_topics, element_identifier_anonymous_sequence_DdsTopic_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_DdsTopic_unbounded_ec) { - element_identifier_anonymous_sequence_DdsTopic_unbounded = new TypeIdentifier(type_ids_topics.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_DdsTopic_unbounded = EK_COMPLETE; @@ -970,50 +518,12 @@ void register_MonitoringTopics_type_identifier( } StructMemberFlag member_flags_topics = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_topics; MemberId member_id_topics = 0x00000000; - if (EK_COMPLETE == type_ids_topics.type_identifier1()._d() || TK_NONE == type_ids_topics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier1()._d() && - EK_COMPLETE == type_ids_topics.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier1()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, - member_flags_topics, type_ids_topics.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_topics.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_topics.type_identifier2()._d() && - EK_COMPLETE == type_ids_topics.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_topics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_topics.type_identifier2()._d() && - (EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_topics.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_topics_ec {false}; + CommonStructMember common_topics {TypeObjectUtils::build_common_struct_member(member_id_topics, member_flags_topics, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_topics, common_topics_ec))}; + if (!common_topics_ec) { - common_topics = TypeObjectUtils::build_common_struct_member(member_id_topics, - member_flags_topics, type_ids_topics.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure topics member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure topics member TypeIdentifier inconsistent."); return; } MemberName name_topics = "topics"; diff --git a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp index 346e4d18..42741d1c 100644 --- a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp +++ b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp @@ -111,6 +111,12 @@ bool DdsTopic::is_valid_dds_topic( return true; } +void DdsTopic::set_type_ids( + const fastdds::dds::xtypes::TypeIdentifierPair& _type_ids) noexcept +{ + type_ids = _type_ids; +} + ///////////////////////// // OPERATORS ///////////////////////// diff --git a/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp b/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp index 09b91d5f..28bf7a2f 100644 --- a/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp +++ b/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index f39d0332..27829bd9 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -20,9 +20,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index 42304ece..e0244456 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -20,13 +20,13 @@ #include #include -#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -198,7 +198,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::ReaderAttributes& reader_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::ReaderQos& reader_qos); + const fastdds::dds::ReaderQos& reader_qos); // Specific enable/disable do not need to be implemented @@ -210,7 +210,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::ReaderAttributes& reader_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::ReaderQos& reader_qos); + const fastdds::dds::ReaderQos& reader_qos); /** * @brief Return an allocated object @@ -275,7 +275,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener const core::types::DdsTopic& topic) noexcept; //! Reader QoS to create RTPS Reader - static fastrtps::ReaderQos reckon_reader_qos_( + static fastdds::dds::ReaderQos reckon_reader_qos_( const core::types::DdsTopic& topic) noexcept; ///// @@ -326,7 +326,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener fastrtps::TopicAttributes topic_attributes_; //! Reader QoS to create the internal RTPS Reader. - fastrtps::ReaderQos reader_qos_; + fastdds::dds::ReaderQos reader_qos_; }; } /* namespace rtps */ diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp index 92515f96..553112fe 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp @@ -15,6 +15,8 @@ #pragma once #include +#include +#include #include #include @@ -38,7 +40,8 @@ class TopicDataType : public eprosima::fastdds::dds::TopicDataType TopicDataType( const std::string& type_name, const bool keyed, - const std::shared_ptr& payload_pool); + const std::shared_ptr& payload_pool, + const fastdds::dds::xtypes::TypeIdentifierPair& type_ids); //! Default destructor DDSPIPE_PARTICIPANTS_DllAPI diff --git a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp index 83242e28..b33fd5d4 100644 --- a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp +++ b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp index 12d607d3..c701021b 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp @@ -15,12 +15,12 @@ #pragma once #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index f42bff0a..fbdc1f62 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -19,11 +19,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -161,7 +161,7 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::WriterAttributes& writer_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::WriterQos& writer_qos, + const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration); // Specific enable/disable do not need to be implemented @@ -224,7 +224,7 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::WriterAttributes& writer_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::WriterQos& writer_qos, + const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration); /** @@ -244,7 +244,7 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener const core::types::DdsTopic& topic) noexcept; //! QoS for RTPS Writer - static fastrtps::WriterQos reckon_writer_qos_( + static fastdds::dds::WriterQos reckon_writer_qos_( const core::types::DdsTopic& topic) noexcept; //! Cache Change Pool Configuration @@ -290,7 +290,7 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener fastrtps::TopicAttributes topic_attributes_; //! Writer QoS to create the internal RTPS Writer. - fastrtps::WriterQos writer_qos_; + fastdds::dds::WriterQos writer_qos_; //! Pool Configuration to create the internal History. utils::PoolConfiguration pool_configuration_; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp index ea74d4eb..7befb817 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp @@ -55,7 +55,7 @@ class QoSSpecificWriter : public CommonWriter protected: //! Specific writer QoS to override (more or less) the CommonWriter qos - static fastrtps::WriterQos reckon_writer_qos_( + static fastdds::dds::WriterQos reckon_writer_qos_( const core::types::SpecificEndpointQoS& specific_qos, const core::types::DdsTopic& topic) noexcept; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp index 3d7997a6..b23741d2 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp @@ -15,12 +15,12 @@ #pragma once #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 261c6484..e941ca29 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -409,7 +409,8 @@ fastdds::dds::Topic* CommonParticipant::topic_related_( new TopicDataType( topic.type_name, topic.topic_qos.keyed, - payload_pool_)) + payload_pool_, + topic.type_ids)) ); } diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index 02bb20c0..c5547c1c 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -41,16 +41,16 @@ XmlParticipant::XmlParticipant( : CommonParticipant(participant_configuration, payload_pool, discovery_database) , xml_specific_configuration_(*reinterpret_cast(configuration_.get())) { - // if (xml_specific_configuration_.participant_profile.is_set()) - // { - // fastdds::dds::DomainParticipantExtendedQos extended_qos; - // if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( - // xml_specific_configuration_.participant_profile.get_value(), - // extended_qos)) - // { - // configuration_->domain = extended_qos.domainId(); - // } - // } + if (xml_specific_configuration_.participant_profile.is_set()) + { + fastdds::dds::DomainParticipantExtendedQos extended_qos; + if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( + xml_specific_configuration_.participant_profile.get_value(), + extended_qos)) + { + configuration_->domain = extended_qos.domainId(); + } + } } std::shared_ptr XmlParticipant::create_writer( diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 43ed329f..1e4d3bcc 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 46adae8f..13ee2425 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp index 12c42db1..d13e56aa 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp @@ -14,8 +14,8 @@ #include -#include -#include +#include +#include #include #include #include diff --git a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp index 1d74d9ea..b51cc17b 100644 --- a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp @@ -184,9 +184,10 @@ utils::ReturnCode CommonReader::take_nts_( // If the payload owner is not set, rtps_data won't release the payload on destruction rtps_data->payload_owner = payload_pool_.get(); - if (!ret) + if (ret != fastdds::dds::RETCODE_OK) { // There has been an error taking the data. Exit. + data.reset(rtps_data.release()); return ret; } } while (!should_accept_sample_(info)); diff --git a/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp index 6d3327af..942297aa 100644 --- a/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp index 85aafba1..0257aba9 100644 --- a/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp index 77243822..6d9423bd 100644 --- a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index c844a06f..d81e965e 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include @@ -44,7 +44,7 @@ CommonReader::CommonReader( const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::ReaderAttributes& reader_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::ReaderQos& reader_qos) + const fastdds::dds::ReaderQos& reader_qos) : BaseReader(participant_id, topic.topic_qos.max_rx_rate, topic.topic_qos.downsampling) , rtps_participant_(rtps_participant) , payload_pool_(payload_pool) @@ -95,7 +95,7 @@ void CommonReader::internal_entities_creation_( const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::ReaderAttributes& reader_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::ReaderQos& reader_qos) + const fastdds::dds::ReaderQos& reader_qos) { // Copy reader attributes because fast needs it non const (do not ask why) fastrtps::rtps::ReaderAttributes non_const_reader_attributes = reader_attributes; @@ -363,10 +363,10 @@ fastrtps::TopicAttributes CommonReader::reckon_topic_attributes_( return att; } -fastrtps::ReaderQos CommonReader::reckon_reader_qos_( +fastdds::dds::ReaderQos CommonReader::reckon_reader_qos_( const core::types::DdsTopic& topic) noexcept { - fastrtps::ReaderQos properties; + fastdds::dds::ReaderQos properties; // Set Durability properties.m_durability.kind = diff --git a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp index 5f80bdaa..d7318455 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp index da05dbb3..a7cd3b4f 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index 81385727..16fc101d 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -29,7 +29,8 @@ using eprosima::ddspipe::core::types::operator <<; TopicDataType::TopicDataType( const std::string& type_name, const bool keyed, - const std::shared_ptr& payload_pool) + const std::shared_ptr& payload_pool, + const fastdds::dds::xtypes::TypeIdentifierPair& type_ids) : type_name_(type_name) , keyed_(keyed) , payload_pool_(payload_pool) @@ -37,10 +38,12 @@ TopicDataType::TopicDataType( // Set topic data m_typeSize = 4; m_isGetKeyDefined = keyed_; - auto_fill_type_information(false); // Set name setName(type_name_.c_str()); + + // Set Type Identifiers + type_identifiers_ = type_ids; } TopicDataType::~TopicDataType() diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index 14546666..37c3b481 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp index 497119bd..cfd0f910 100644 --- a/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp index 59dd746a..014aca6d 100644 --- a/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index 4ad6c949..cfaca2f1 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 908d2df5..c031b837 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include +#include +#include +#include #include @@ -48,7 +48,7 @@ CommonWriter::CommonWriter( const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::WriterAttributes& writer_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::WriterQos& writer_qos, + const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration) : BaseWriter(participant_id, topic.topic_qos.max_tx_rate) , rtps_participant_(rtps_participant) @@ -265,7 +265,7 @@ void CommonWriter::internal_entities_creation_( const fastrtps::rtps::HistoryAttributes& history_attributes, const fastrtps::rtps::WriterAttributes& writer_attributes, const fastrtps::TopicAttributes& topic_attributes, - const fastrtps::WriterQos& writer_qos, + const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration) { // Copy writer attributes because fast needs it non const (do not ask why) @@ -414,10 +414,10 @@ fastrtps::TopicAttributes CommonWriter::reckon_topic_attributes_( return att; } -fastrtps::WriterQos CommonWriter::reckon_writer_qos_( +fastdds::dds::WriterQos CommonWriter::reckon_writer_qos_( const core::types::DdsTopic& topic) noexcept { - fastrtps::WriterQos qos; + fastdds::dds::WriterQos qos; // Set Durability qos.m_durability.kind = diff --git a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp index 0a369a4f..e3226924 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp index 7bfd9431..de959650 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp @@ -40,12 +40,12 @@ QoSSpecificWriter::QoSSpecificWriter( { } -fastrtps::WriterQos QoSSpecificWriter::reckon_writer_qos_( +fastdds::dds::WriterQos QoSSpecificWriter::reckon_writer_qos_( const SpecificEndpointQoS& specific_qos, const DdsTopic& topic) noexcept { // Get QoS from parent class - fastrtps::WriterQos qos = CommonWriter::reckon_writer_qos_(topic); + fastdds::dds::WriterQos qos = CommonWriter::reckon_writer_qos_(topic); // Set Partitions if (topic.topic_qos.has_partitions()) diff --git a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp index e4953953..8cf99c39 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp b/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp index d95c00ff..0428db44 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp b/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp index 03876cc4..004e3ba3 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include From 4a516a841ed622b3c642cf89fd9c238c12044a42 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 11 Jun 2024 13:37:21 +0200 Subject: [PATCH 08/53] Apply suggested changes Signed-off-by: Lucia Echevarria --- .../types/dynamic_types/types.hpp | 10 +- .../ddspipe_core/types/topic/dds/DdsTopic.hpp | 3 - .../src/cpp/communication/dds/Track.cpp | 3 +- .../cpp/types/dynamic_types/schema_idl.cpp | 54 +- .../src/cpp/types/topic/dds/DdsTopic.cpp | 6 - .../types/dynamic_types/types/all_types.hpp | 115 +- .../arrays_and_sequencesPubSubTypes.cxx | 8 +- .../arrays_and_sequencesPubSubTypes.h | 4 +- .../arrays_and_sequencesTypeObjectSupport.cxx | 1023 +----- .../arrays_and_sequencesTypeObjectSupport.hpp | 21 +- .../basic_array_structPubSubTypes.cxx | 8 +- .../basic_array_structPubSubTypes.h | 4 +- .../basic_array_structTypeObjectSupport.cxx | 501 +-- .../basic_array_structTypeObjectSupport.hpp | 21 +- .../type_objects/basic_structPubSubTypes.cxx | 8 +- .../type_objects/basic_structPubSubTypes.h | 4 +- .../basic_structTypeObjectSupport.cxx | 254 +- .../basic_structTypeObjectSupport.hpp | 21 +- .../type_objects/char_sequencePubSubTypes.cxx | 4 +- .../type_objects/char_sequencePubSubTypes.h | 2 +- .../char_sequenceTypeObjectSupport.cxx | 160 +- .../char_sequenceTypeObjectSupport.hpp | 14 +- .../complex_nested_arraysPubSubTypes.cxx | 16 +- .../complex_nested_arraysPubSubTypes.h | 8 +- ...complex_nested_arraysTypeObjectSupport.cxx | 2874 +---------------- ...complex_nested_arraysTypeObjectSupport.hpp | 35 +- .../type_objects/enum_structPubSubTypes.cxx | 4 +- .../type_objects/enum_structPubSubTypes.h | 2 +- .../enum_structTypeObjectSupport.cxx | 249 +- .../enum_structTypeObjectSupport.hpp | 26 +- .../float_bounded_sequencePubSubTypes.cxx | 4 +- .../float_bounded_sequencePubSubTypes.h | 2 +- ...loat_bounded_sequenceTypeObjectSupport.cxx | 160 +- ...loat_bounded_sequenceTypeObjectSupport.hpp | 14 +- .../type_objects/hello_worldPubSubTypes.cxx | 4 +- .../type_objects/hello_worldPubSubTypes.h | 2 +- .../hello_worldTypeObjectSupport.cxx | 166 +- .../hello_worldTypeObjectSupport.hpp | 14 +- .../type_objects/map_structPubSubTypes.cxx | 4 +- .../type_objects/map_structPubSubTypes.h | 2 +- .../map_structTypeObjectSupport.cxx | 234 +- .../map_structTypeObjectSupport.hpp | 14 +- .../type_objects/numeric_arrayPubSubTypes.cxx | 4 +- .../type_objects/numeric_arrayPubSubTypes.h | 2 +- .../numeric_arrayTypeObjectSupport.cxx | 162 +- .../numeric_arrayTypeObjectSupport.hpp | 14 +- .../type_objects/union_structPubSubTypes.cxx | 4 +- .../type_objects/union_structPubSubTypes.h | 2 +- .../union_structTypeObjectSupport.cxx | 644 +--- .../union_structTypeObjectSupport.hpp | 21 +- .../participant/dds/CommonParticipant.hpp | 12 +- .../dynamic_types/DynTypesParticipant.hpp | 23 +- .../dynamic_types/ISchemaHandler.hpp | 8 +- .../types/dds/TopicDataType.hpp | 13 +- .../writer/rtps/CommonWriter.hpp | 17 +- .../writer/rtps/QoSSpecificWriter.hpp | 9 + .../cpp/participant/dds/CommonParticipant.cpp | 6 +- .../cpp/participant/dds/XmlParticipant.cpp | 16 +- .../dynamic_types/DynTypesParticipant.cpp | 55 +- .../src/cpp/reader/dds/CommonReader.cpp | 1 - .../src/cpp/reader/rtps/CommonReader.cpp | 6 +- .../src/cpp/types/dds/TopicDataType.cpp | 10 +- .../src/cpp/writer/auxiliar/BaseWriter.cpp | 21 +- .../writer/dynamic_types/TypeObjectWriter.cpp | 3 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 15 +- .../src/cpp/xml/XmlHandler.cpp | 4 +- .../src/cpp/xml/XmlHandlerConfiguration.cpp | 15 - 67 files changed, 1053 insertions(+), 6116 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp index 15c92938..08df14e0 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp @@ -14,17 +14,15 @@ #pragma once -#include - #include #include -#include +#include #include #include -#include #include +#include namespace eprosima { namespace ddspipe { @@ -42,9 +40,9 @@ struct DynamicTypeData : public core::IRoutingData fastdds::dds::DynamicType::_ref_type dynamic_type{nullptr}; - std::tuple type_ids_tuple{}; + fastcdr::string_255 type_name{}; - // fastdds::dds::xtypes::TypeInformation type_information{}; + fastdds::dds::xtypes::TypeIdentifier type_id{}; }; DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp index f4a3485d..b86c3a0d 100644 --- a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp +++ b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp @@ -81,9 +81,6 @@ struct DdsTopic : public DistributedTopic const std::string& type_name, utils::Formatter& error_msg) noexcept; - void set_type_ids( - const fastdds::dds::xtypes::TypeIdentifierPair& _type_ids) noexcept; - ///////////////////////// // VARIABLES ///////////////////////// diff --git a/ddspipe_core/src/cpp/communication/dds/Track.cpp b/ddspipe_core/src/cpp/communication/dds/Track.cpp index e1405078..db449327 100644 --- a/ddspipe_core/src/cpp/communication/dds/Track.cpp +++ b/ddspipe_core/src/cpp/communication/dds/Track.cpp @@ -19,13 +19,12 @@ #include #include +#include #include #include #include -#include - namespace eprosima { namespace ddspipe { namespace core { diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp index e799d6ee..dd3f214d 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp @@ -23,7 +23,7 @@ #include #include #include -#include //To include xtypes constants +#include #include #include @@ -38,6 +38,8 @@ namespace core { namespace types { namespace idl { +// TODO: Include compability with TK_ALIAS, TK_BITSET AND TK_BITMASK + constexpr const char* TYPE_OPENING = "\n{\n"; @@ -72,23 +74,27 @@ fastdds::dds::DynamicType::_ref_type container_internal_type( const fastdds::dds::DynamicType::_ref_type& dyn_type) { fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; + const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { - throw utils::InconsistencyException("No Type Descriptor"); + throw utils::InconsistencyException("No Type Descriptor, failed to get conatiner internal type"); } + return type_descriptor->element_type(); } -std::vector container_size( +fastdds::dds::BoundSeq container_size( const fastdds::dds::DynamicType::_ref_type& dyn_type) { fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; + const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { - throw utils::InconsistencyException("No Type Descriptor"); + throw utils::InconsistencyException("No Type Descriptor, failed to get container size"); } + return type_descriptor->bound(); } @@ -102,18 +108,20 @@ std::vector> get_me for (const auto& member : members) { - fastdds::dds::ObjectName dyn_name = member.second->get_name(); fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; + const auto ret = member.second->get_descriptor(member_descriptor); if (ret != fastdds::dds::RETCODE_OK) { - throw utils::InconsistencyException("No Member Descriptor"); + throw utils::InconsistencyException("No Member Descriptor, failed to get sorted members"); } + result.emplace_back( std::make_pair( - dyn_name.to_string(), + member.second->get_name().to_string(), std::move(member_descriptor->type()))); } + return result; } @@ -160,13 +168,16 @@ std::string map_kind_to_str( { std::stringstream ss; fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; + const auto ret = dyn_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { - throw utils::InconsistencyException("No Type Descriptor"); + throw utils::InconsistencyException("No Type Descriptor, failed to map kind"); } - auto key_type = type_descriptor->key_element_type(); - auto value_type = type_descriptor->element_type(); + + const auto key_type = type_descriptor->key_element_type(); + const auto value_type = type_descriptor->element_type(); + ss << "map<" << type_kind_to_str(key_type) << ", " << type_kind_to_str(value_type) << ">"; return ss.str(); @@ -183,6 +194,9 @@ std::string type_kind_to_str( case fastdds::dds::xtypes::TK_BYTE: return "octet"; + case fastdds::dds::xtypes::TK_INT8: + return "short"; + case fastdds::dds::xtypes::TK_INT16: return "short"; @@ -192,6 +206,9 @@ std::string type_kind_to_str( case fastdds::dds::xtypes::TK_INT64: return "long long"; + case fastdds::dds::xtypes::TK_UINT8: + return "unsigned short"; + case fastdds::dds::xtypes::TK_UINT16: return "unsigned short"; @@ -234,7 +251,7 @@ std::string type_kind_to_str( case fastdds::dds::xtypes::TK_STRUCTURE: case fastdds::dds::xtypes::TK_ENUM: case fastdds::dds::xtypes::TK_UNION: - return (dyn_type->get_name()).to_string(); + return dyn_type->get_name().to_string(); case fastdds::dds::xtypes::TK_BITSET: case fastdds::dds::xtypes::TK_BITMASK: @@ -265,7 +282,7 @@ utils::TreeNode generate_dyn_type_tree( utils::TreeNode parent(member_name, (type->get_name()).to_string(), type); // Get all members of this struct - std::vector> members_by_name = get_members_sorted(type); for (const auto& member : members_by_name) @@ -345,8 +362,10 @@ std::ostream& enum_to_str( { os << "enum " << node.info.type_kind_name << TYPE_OPENING << TAB_SEPARATOR; - std::map members; + std::map members; + node.info.dynamic_type->get_all_members(members); + bool first_iter = true; for (const auto& member : members) { @@ -370,25 +389,32 @@ std::ostream& union_to_str( const utils::TreeNode& node) { fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; + const auto ret = node.info.dynamic_type->get_descriptor(type_descriptor); if (ret != fastdds::dds::RETCODE_OK) { - throw utils::InconsistencyException("No Type Descriptor"); + throw utils::InconsistencyException("No Type Descriptor, failed to convert union to string"); } + os << "union " << node.info.type_kind_name << " switch (" << type_kind_to_str( type_descriptor->discriminator_type()) << ")" << TYPE_OPENING; std::map members; + node.info.dynamic_type->get_all_members(members); // WARNING: Default case not included in this collection, and currently not available + for (const auto& member : members) { fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; + const auto ret = member.second->get_descriptor(member_descriptor); if (ret != fastdds::dds::RETCODE_OK) { throw utils::InconsistencyException("No Member Descriptor"); } + auto labels = member_descriptor->label(); // WARNING: There might be casting issues as discriminant type is currently not taken into consideration + bool first_iter = true; for (const auto& label : labels) { diff --git a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp index 42741d1c..346e4d18 100644 --- a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp +++ b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp @@ -111,12 +111,6 @@ bool DdsTopic::is_valid_dds_topic( return true; } -void DdsTopic::set_type_ids( - const fastdds::dds::xtypes::TypeIdentifierPair& _type_ids) noexcept -{ - type_ids = _type_ids; -} - ///////////////////////// // OPERATORS ///////////////////////// diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp index 29a602bf..6c93ae75 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp @@ -30,22 +30,45 @@ #include #include +#include #include #include #include #include -#include "type_objects/hello_worldTypeObjectSupport.hpp" -#include "type_objects/numeric_arrayTypeObjectSupport.hpp" -#include "type_objects/char_sequenceTypeObjectSupport.hpp" -#include "type_objects/basic_structTypeObjectSupport.hpp" -#include "type_objects/basic_array_structTypeObjectSupport.hpp" -#include "type_objects/float_bounded_sequenceTypeObjectSupport.hpp" -#include "type_objects/arrays_and_sequencesTypeObjectSupport.hpp" -#include "type_objects/complex_nested_arraysTypeObjectSupport.hpp" -#include "type_objects/enum_structTypeObjectSupport.hpp" -#include "type_objects/union_structTypeObjectSupport.hpp" -#include "type_objects/map_structTypeObjectSupport.hpp" +#include "type_objects/arrays_and_sequences.hpp" +#include "type_objects/arrays_and_sequencesPubSubTypes.h" + +#include "type_objects/basic_array_struct.hpp" +#include "type_objects/basic_array_structPubSubTypes.h" + +#include "type_objects/basic_struct.hpp" +#include "type_objects/basic_structPubSubTypes.h" + +#include "type_objects/char_sequence.hpp" +#include "type_objects/char_sequencePubSubTypes.h" + +#include "type_objects/complex_nested_arrays.hpp" +#include "type_objects/complex_nested_arraysPubSubTypes.h" + +#include "type_objects/enum_struct.hpp" +#include "type_objects/enum_structPubSubTypes.h" + +#include "type_objects/float_bounded_sequence.hpp" +#include "type_objects/float_bounded_sequencePubSubTypes.h" + +#include "type_objects/hello_world.hpp" +#include "type_objects/hello_worldPubSubTypes.h" + +#include "type_objects/map_struct.hpp" +#include "type_objects/map_structPubSubTypes.h" + +#include "type_objects/numeric_array.hpp" +#include "type_objects/numeric_arrayPubSubTypes.h" + +#include "type_objects/union_struct.hpp" +#include "type_objects/union_structPubSubTypes.h" + namespace test { @@ -65,37 +88,51 @@ ENUMERATION_BUILDER( ); eprosima::fastdds::dds::DynamicType::_ref_type get_dynamic_type( // traits::ref_type - SupportedType type) + SupportedType dyn_type) { - register_hello_world_type_objects(); - register_numeric_array_type_objects(); - register_char_sequence_type_objects(); - register_basic_struct_type_objects(); - register_basic_array_struct_type_objects(); - register_float_bounded_sequence_type_objects(); - register_arrays_and_sequences_type_objects(); - register_complex_nested_arrays_type_objects(); - register_enum_struct_type_objects(); - register_union_struct_type_objects(); - register_map_struct_type_objects(); - - auto type_name = to_string(type); - eprosima::fastdds::dds::xtypes::TypeInformation type_information; - if (eprosima::fastdds::dds::RETCODE_OK != eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - type_name, - type_information)) - { - return nullptr; - } - eprosima::fastdds::dds::xtypes::TypeIdentifier type_id; - type_id = type_information.complete().typeid_with_size().type_id(); + // Register the type + eprosima::fastdds::dds::TypeSupport type_arrays_and_sequences(new arrays_and_sequencesPubSubType()); + type_arrays_and_sequences->register_type_object_representation(); - eprosima::fastdds::dds::xtypes::TypeObject type_obj; - if (eprosima::fastdds::dds::RETCODE_OK == eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( - type_id, - type_obj)) + eprosima::fastdds::dds::TypeSupport type_basic_array_struct(new basic_array_structPubSubType()); + type_basic_array_struct->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_basic_struct(new basic_structPubSubType()); + type_basic_struct->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_complex_nested_arrays(new complex_nested_arraysPubSubType()); + type_complex_nested_arrays->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_char_sequence(new char_sequencePubSubType()); + type_char_sequence->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_enum_struct(new enum_structPubSubType()); + type_enum_struct->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_float_bounded_sequence(new float_bounded_sequencePubSubType()); + type_float_bounded_sequence->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_hello_world(new hello_worldPubSubType()); + type_hello_world->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_map_struct(new map_structPubSubType()); + type_map_struct->register_type_object_representation(); + + eprosima::fastdds::dds::TypeSupport type_numeric_array(new numeric_arrayPubSubType()); + type_numeric_array->register_type_object_representation(); + + + eprosima::fastdds::dds::TypeSupport type_union_struct(new union_structPubSubType()); + type_union_struct->register_type_object_representation(); + + auto type_name = to_string(dyn_type); + + eprosima::fastdds::dds::xtypes::TypeObjectPair type_objs; + if (eprosima::fastdds::dds::RETCODE_OK == eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_objects( + type_name, + type_objs)) { - return eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(type_obj)->build(); + return eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(type_objs.complete_type_object)->build(); } else diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx index ea826829..5b568927 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx @@ -219,9 +219,9 @@ bool AnInternalObjectPubSubType::getKey( return true; } -void AnInternalObjectPubSubType::register_type_object_representation() const +void AnInternalObjectPubSubType::register_type_object_representation() { - register_arrays_and_sequences_type_objects(); + register_AnInternalObject_type_identifier(type_identifiers_); } arrays_and_sequencesPubSubType::arrays_and_sequencesPubSubType() @@ -412,9 +412,9 @@ bool arrays_and_sequencesPubSubType::getKey( return true; } -void arrays_and_sequencesPubSubType::register_type_object_representation() const +void arrays_and_sequencesPubSubType::register_type_object_representation() { - register_arrays_and_sequences_type_objects(); + register_arrays_and_sequences_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h index ff8fc7e7..f9e19c21 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h @@ -89,7 +89,7 @@ class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -180,7 +180,7 @@ class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataT void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx index d0177d64..2f05a271 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx @@ -38,25 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_arrays_and_sequences_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_AnInternalObject_type_identifier( + TypeIdentifierPair& type_ids_AnInternalObject) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_AnInternalObject_type_identifier(); - - register_arrays_and_sequences_type_identifier(); - - }); -} -void register_AnInternalObject_type_identifier() -{ + ReturnCode_t return_code_AnInternalObject {eprosima::fastdds::dds::RETCODE_OK}; + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_AnInternalObject); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_AnInternalObject) { StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_AnInternalObject; - TypeIdentifierPair type_ids_AnInternalObject; QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; eprosima::fastcdr::optional ann_custom_AnInternalObject; @@ -65,11 +59,13 @@ void register_AnInternalObject_type_identifier() header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); CompleteStructMemberSeq member_seq_AnInternalObject; { - return_code_AnInternalObject = + TypeIdentifierPair type_ids_x; + ReturnCode_t return_code_x {eprosima::fastdds::dds::RETCODE_OK}; + return_code_x = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_float", type_ids_AnInternalObject); + "_float", type_ids_x); - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_x) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -77,48 +73,12 @@ void register_AnInternalObject_type_identifier() } StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_x; MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_x_ec {false}; + CommonStructMember common_x {TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_x, common_x_ec))}; + if (!common_x_ec) { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure x member TypeIdentifier inconsistent."); return; } MemberName name_x = "x"; @@ -129,11 +89,13 @@ void register_AnInternalObject_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); } { - return_code_AnInternalObject = + TypeIdentifierPair type_ids_positive; + ReturnCode_t return_code_positive {eprosima::fastdds::dds::RETCODE_OK}; + return_code_positive = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_AnInternalObject); + "_bool", type_ids_positive); - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_positive) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -141,48 +103,12 @@ void register_AnInternalObject_type_identifier() } StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_positive; MemberId member_id_positive = 0x00000001; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_positive_ec {false}; + CommonStructMember common_positive {TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_positive, common_positive_ec))}; + if (!common_positive_ec) { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure positive member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure positive member TypeIdentifier inconsistent."); return; } MemberName name_positive = "positive"; @@ -194,29 +120,26 @@ void register_AnInternalObject_type_identifier() } CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string(), type_ids_AnInternalObject)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "AnInternalObject already registered in TypeObjectRegistry for a different type."); } - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_AnInternalObject); - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_arrays_and_sequences_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_arrays_and_sequences_type_identifier( + TypeIdentifierPair& type_ids_arrays_and_sequences) { + + ReturnCode_t return_code_arrays_and_sequences {eprosima::fastdds::dds::RETCODE_OK}; + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "arrays_and_sequences", type_ids_arrays_and_sequences); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_arrays_and_sequences) { StructTypeFlag struct_flags_arrays_and_sequences = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_arrays_and_sequences; - TypeIdentifierPair type_ids_arrays_and_sequences; QualifiedTypeName type_name_arrays_and_sequences = "arrays_and_sequences"; eprosima::fastcdr::optional type_ann_builtin_arrays_and_sequences; eprosima::fastcdr::optional ann_custom_arrays_and_sequences; @@ -225,305 +148,56 @@ void register_arrays_and_sequences_type_identifier() header_arrays_and_sequences = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_arrays_and_sequences); CompleteStructMemberSeq member_seq_arrays_and_sequences; { - return_code_arrays_and_sequences = + TypeIdentifierPair type_ids_unlimited_vector; + ReturnCode_t return_code_unlimited_vector {eprosima::fastdds::dds::RETCODE_OK}; + return_code_unlimited_vector = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_AnInternalObject_unbounded", type_ids_arrays_and_sequences); + "anonymous_sequence_AnInternalObject_unbounded", type_ids_unlimited_vector); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_unlimited_vector) { - return_code_arrays_and_sequences = + return_code_unlimited_vector = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_arrays_and_sequences); + "AnInternalObject", type_ids_unlimited_vector); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_AnInternalObject; - TypeIdentifierPair type_ids_AnInternalObject; - QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; - eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; - eprosima::fastcdr::optional ann_custom_AnInternalObject; - CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); - CompleteStructHeader header_AnInternalObject; - header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); - CompleteStructMemberSeq member_seq_AnInternalObject; - { - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_float", type_ids_AnInternalObject); - - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); - } - { - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_AnInternalObject); - - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_positive; - MemberId member_id_positive = 0x00000001; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure positive member TypeIdentifier inconsistent."); - return; - } - MemberName name_positive = "positive"; - eprosima::fastcdr::optional member_ann_builtin_positive; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); - CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); - } - CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject already registered in TypeObjectRegistry for a different type."); - } - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_AnInternalObject); - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_unlimited_vector) { - element_identifier_anonymous_sequence_AnInternalObject_unbounded = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier1()); + ::register_AnInternalObject_type_identifier(type_ids_unlimited_vector); } - else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_unlimited_vector, element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec) { - element_identifier_anonymous_sequence_AnInternalObject_unbounded = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d()) + if (TK_NONE == type_ids_unlimited_vector.type_identifier2()._d()) { equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_unbounded = 0; PlainCollectionHeader header_anonymous_sequence_AnInternalObject_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_unbounded, element_flags_anonymous_sequence_AnInternalObject_unbounded); - std::string type_id_kind_anonymous_sequence_AnInternalObject_unbounded("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_AnInternalObject_unbounded == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = 0; PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_unbounded, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_unbounded)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_AnInternalObject_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 0; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_AnInternalObject_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_AnInternalObject_unbounded")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_unbounded", type_ids_unlimited_vector)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_AnInternalObject_unbounded already registered in TypeObjectRegistry for a different type."); } } - return_code_arrays_and_sequences = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_AnInternalObject_unbounded", type_ids_arrays_and_sequences); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_AnInternalObject_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_unlimited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_unlimited_vector; MemberId member_id_unlimited_vector = 0x00000000; - if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_unlimited_vector = TypeObjectUtils::build_common_struct_member(member_id_unlimited_vector, member_flags_unlimited_vector, type_ids_arrays_and_sequences.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_unlimited_vector = TypeObjectUtils::build_common_struct_member(member_id_unlimited_vector, member_flags_unlimited_vector, type_ids_arrays_and_sequences.type_identifier2()); - } - else + bool common_unlimited_vector_ec {false}; + CommonStructMember common_unlimited_vector {TypeObjectUtils::build_common_struct_member(member_id_unlimited_vector, member_flags_unlimited_vector, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_unlimited_vector, common_unlimited_vector_ec))}; + if (!common_unlimited_vector_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure unlimited_vector member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure unlimited_vector member TypeIdentifier inconsistent."); return; } MemberName name_unlimited_vector = "unlimited_vector"; @@ -534,305 +208,56 @@ void register_arrays_and_sequences_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_unlimited_vector); } { - return_code_arrays_and_sequences = + TypeIdentifierPair type_ids_limited_vector; + ReturnCode_t return_code_limited_vector {eprosima::fastdds::dds::RETCODE_OK}; + return_code_limited_vector = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_AnInternalObject_10", type_ids_arrays_and_sequences); + "anonymous_sequence_AnInternalObject_10", type_ids_limited_vector); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_vector) { - return_code_arrays_and_sequences = + return_code_limited_vector = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_arrays_and_sequences); - - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_AnInternalObject; - TypeIdentifierPair type_ids_AnInternalObject; - QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; - eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; - eprosima::fastcdr::optional ann_custom_AnInternalObject; - CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); - CompleteStructHeader header_AnInternalObject; - header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); - CompleteStructMemberSeq member_seq_AnInternalObject; - { - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_float", type_ids_AnInternalObject); - - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); - } - { - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_AnInternalObject); + "AnInternalObject", type_ids_limited_vector); - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_positive; - MemberId member_id_positive = 0x00000001; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure positive member TypeIdentifier inconsistent."); - return; - } - MemberName name_positive = "positive"; - eprosima::fastcdr::optional member_ann_builtin_positive; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); - CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); - } - CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject already registered in TypeObjectRegistry for a different type."); - } - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_AnInternalObject); - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_10 {nullptr}; - if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_vector) { - element_identifier_anonymous_sequence_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier2()); + ::register_AnInternalObject_type_identifier(type_ids_limited_vector); } - else + bool element_identifier_anonymous_sequence_AnInternalObject_10_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_10 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_vector, element_identifier_anonymous_sequence_AnInternalObject_10_ec))}; + if (!element_identifier_anonymous_sequence_AnInternalObject_10_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_COMPLETE; - if (TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d()) + if (TK_NONE == type_ids_limited_vector.type_identifier2()._d()) { equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_10 = 0; PlainCollectionHeader header_anonymous_sequence_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_10, element_flags_anonymous_sequence_AnInternalObject_10); - std::string type_id_kind_anonymous_sequence_AnInternalObject_10("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_AnInternalObject_10 == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = static_cast(10); PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_10, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_10)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_10")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_10", type_ids_limited_vector)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); } } - else - { - LBound bound = 10; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_AnInternalObject_10, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_10)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_AnInternalObject_10")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); - } - } - return_code_arrays_and_sequences = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_AnInternalObject_10", type_ids_arrays_and_sequences); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_AnInternalObject_10: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_limited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_limited_vector; MemberId member_id_limited_vector = 0x00000001; - if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_limited_vector = TypeObjectUtils::build_common_struct_member(member_id_limited_vector, member_flags_limited_vector, type_ids_arrays_and_sequences.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_limited_vector = TypeObjectUtils::build_common_struct_member(member_id_limited_vector, member_flags_limited_vector, type_ids_arrays_and_sequences.type_identifier2()); - } - else + bool common_limited_vector_ec {false}; + CommonStructMember common_limited_vector {TypeObjectUtils::build_common_struct_member(member_id_limited_vector, member_flags_limited_vector, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_vector, common_limited_vector_ec))}; + if (!common_limited_vector_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure limited_vector member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure limited_vector member TypeIdentifier inconsistent."); return; } MemberName name_limited_vector = "limited_vector"; @@ -843,228 +268,36 @@ void register_arrays_and_sequences_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_limited_vector); } { - return_code_arrays_and_sequences = + TypeIdentifierPair type_ids_limited_array; + ReturnCode_t return_code_limited_array {eprosima::fastdds::dds::RETCODE_OK}; + return_code_limited_array = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_AnInternalObject_10", type_ids_arrays_and_sequences); + "anonymous_array_AnInternalObject_10", type_ids_limited_array); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_array) { - return_code_arrays_and_sequences = + return_code_limited_array = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_arrays_and_sequences); + "AnInternalObject", type_ids_limited_array); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_array) { - { - StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_AnInternalObject; - TypeIdentifierPair type_ids_AnInternalObject; - QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; - eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; - eprosima::fastcdr::optional ann_custom_AnInternalObject; - CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); - CompleteStructHeader header_AnInternalObject; - header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); - CompleteStructMemberSeq member_seq_AnInternalObject; - { - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_float", type_ids_AnInternalObject); - - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); - } - { - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_AnInternalObject); - - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_positive; - MemberId member_id_positive = 0x00000001; - if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1()._d() || TK_NONE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_AnInternalObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_AnInternalObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_AnInternalObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure positive member TypeIdentifier inconsistent."); - return; - } - MemberName name_positive = "positive"; - eprosima::fastcdr::optional member_ann_builtin_positive; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); - CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); - } - CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject already registered in TypeObjectRegistry for a different type."); - } - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_AnInternalObject); - if (return_code_AnInternalObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_AnInternalObject_type_identifier(type_ids_limited_array); } - TypeIdentifier* element_identifier_anonymous_array_AnInternalObject_10 {nullptr}; - if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool element_identifier_anonymous_array_AnInternalObject_10_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_AnInternalObject_10 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_array, element_identifier_anonymous_array_AnInternalObject_10_ec))}; + if (!element_identifier_anonymous_array_AnInternalObject_10_ec) { - element_identifier_anonymous_array_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_array_AnInternalObject_10 = new TypeIdentifier(type_ids_arrays_and_sequences.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Array element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_array_AnInternalObject_10 = EK_COMPLETE; - if (TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d()) + if (TK_NONE == type_ids_limited_array.type_identifier2()._d()) { equiv_kind_anonymous_array_AnInternalObject_10 = EK_BOTH; } CollectionElementFlag element_flags_anonymous_array_AnInternalObject_10 = 0; PlainCollectionHeader header_anonymous_array_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_AnInternalObject_10, element_flags_anonymous_array_AnInternalObject_10); - std::string type_id_kind_anonymous_array_AnInternalObject_10("TI_PLAIN_ARRAY_SMALL"); - if (type_id_kind_anonymous_array_AnInternalObject_10 == "TI_PLAIN_ARRAY_SMALL") { SBoundSeq array_bound_seq; TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(10)); @@ -1072,80 +305,21 @@ void register_arrays_and_sequences_type_identifier() PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_AnInternalObject_10, array_bound_seq, eprosima::fastcdr::external(element_identifier_anonymous_array_AnInternalObject_10)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_AnInternalObject_10")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(10)); - - PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_AnInternalObject_10, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_AnInternalObject_10)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_AnInternalObject_10")) + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_AnInternalObject_10", type_ids_limited_array)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_array_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); } } - return_code_arrays_and_sequences = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_AnInternalObject_10", type_ids_arrays_and_sequences); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_AnInternalObject_10: Given Array TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_limited_array = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_limited_array; MemberId member_id_limited_array = 0x00000002; - if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1()._d() || TK_NONE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier1()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_limited_array = TypeObjectUtils::build_common_struct_member(member_id_limited_array, member_flags_limited_array, type_ids_arrays_and_sequences.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_arrays_and_sequences.type_identifier2()._d() && - (EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_arrays_and_sequences.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_limited_array_ec {false}; + CommonStructMember common_limited_array {TypeObjectUtils::build_common_struct_member(member_id_limited_array, member_flags_limited_array, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_array, common_limited_array_ec))}; + if (!common_limited_array_ec) { - common_limited_array = TypeObjectUtils::build_common_struct_member(member_id_limited_array, member_flags_limited_array, type_ids_arrays_and_sequences.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure limited_array member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure limited_array member TypeIdentifier inconsistent."); return; } MemberName name_limited_array = "limited_array"; @@ -1157,20 +331,11 @@ void register_arrays_and_sequences_type_identifier() } CompleteStructType struct_type_arrays_and_sequences = TypeObjectUtils::build_complete_struct_type(struct_flags_arrays_and_sequences, header_arrays_and_sequences, member_seq_arrays_and_sequences); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_arrays_and_sequences, type_name_arrays_and_sequences.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_arrays_and_sequences, type_name_arrays_and_sequences.to_string(), type_ids_arrays_and_sequences)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "arrays_and_sequences already registered in TypeObjectRegistry for a different type."); } - return_code_arrays_and_sequences = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "arrays_and_sequences", type_ids_arrays_and_sequences); - if (return_code_arrays_and_sequences != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "arrays_and_sequences: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp index fd4c5e4b..6f6fb054 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_arrays_and_sequences_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,15 +42,25 @@ eProsima_user_DllExport void register_arrays_and_sequences_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_AnInternalObject_type_identifier(); +eProsima_user_DllExport void register_AnInternalObject_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register arrays_and_sequences related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_arrays_and_sequences_type_identifier(); +eProsima_user_DllExport void register_arrays_and_sequences_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx index c0b9597a..d0517c68 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx @@ -219,9 +219,9 @@ bool TheOtherObjectInArrayPubSubType::getKey( return true; } -void TheOtherObjectInArrayPubSubType::register_type_object_representation() const +void TheOtherObjectInArrayPubSubType::register_type_object_representation() { - register_basic_array_struct_type_objects(); + register_TheOtherObjectInArray_type_identifier(type_identifiers_); } basic_array_structPubSubType::basic_array_structPubSubType() @@ -412,9 +412,9 @@ bool basic_array_structPubSubType::getKey( return true; } -void basic_array_structPubSubType::register_type_object_representation() const +void basic_array_structPubSubType::register_type_object_representation() { - register_basic_array_struct_type_objects(); + register_basic_array_struct_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h index f287a3ff..3a94f899 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h @@ -89,7 +89,7 @@ class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicData void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -180,7 +180,7 @@ class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataTyp void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx index 8f61b361..c31d8a40 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx @@ -38,25 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_basic_array_struct_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_TheOtherObjectInArray_type_identifier( + TypeIdentifierPair& type_ids_TheOtherObjectInArray) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_TheOtherObjectInArray_type_identifier(); - - register_basic_array_struct_type_identifier(); - - }); -} -void register_TheOtherObjectInArray_type_identifier() -{ + ReturnCode_t return_code_TheOtherObjectInArray {eprosima::fastdds::dds::RETCODE_OK}; + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObjectInArray) { StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_TheOtherObjectInArray; - TypeIdentifierPair type_ids_TheOtherObjectInArray; QualifiedTypeName type_name_TheOtherObjectInArray = "TheOtherObjectInArray"; eprosima::fastcdr::optional type_ann_builtin_TheOtherObjectInArray; eprosima::fastcdr::optional ann_custom_TheOtherObjectInArray; @@ -65,11 +59,13 @@ void register_TheOtherObjectInArray_type_identifier() header_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObjectInArray); CompleteStructMemberSeq member_seq_TheOtherObjectInArray; { - return_code_TheOtherObjectInArray = + TypeIdentifierPair type_ids_some_num; + ReturnCode_t return_code_some_num {eprosima::fastdds::dds::RETCODE_OK}; + return_code_some_num = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_TheOtherObjectInArray); + "_int32_t", type_ids_some_num); - if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_some_num) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -77,48 +73,12 @@ void register_TheOtherObjectInArray_type_identifier() } StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_some_num; MemberId member_id_some_num = 0x00000000; - if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_some_num_ec {false}; + CommonStructMember common_some_num {TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_some_num, common_some_num_ec))}; + if (!common_some_num_ec) { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure some_num member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure some_num member TypeIdentifier inconsistent."); return; } MemberName name_some_num = "some_num"; @@ -129,11 +89,13 @@ void register_TheOtherObjectInArray_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_some_num); } { - return_code_TheOtherObjectInArray = + TypeIdentifierPair type_ids_positive; + ReturnCode_t return_code_positive {eprosima::fastdds::dds::RETCODE_OK}; + return_code_positive = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_TheOtherObjectInArray); + "_bool", type_ids_positive); - if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_positive) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -141,48 +103,12 @@ void register_TheOtherObjectInArray_type_identifier() } StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_positive; MemberId member_id_positive = 0x00000001; - if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier2()); - } - else + bool common_positive_ec {false}; + CommonStructMember common_positive {TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_positive, common_positive_ec))}; + if (!common_positive_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure positive member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure positive member TypeIdentifier inconsistent."); return; } MemberName name_positive = "positive"; @@ -194,29 +120,26 @@ void register_TheOtherObjectInArray_type_identifier() } CompleteStructType struct_type_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObjectInArray, header_TheOtherObjectInArray, member_seq_TheOtherObjectInArray); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string(), type_ids_TheOtherObjectInArray)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "TheOtherObjectInArray already registered in TypeObjectRegistry for a different type."); } - return_code_TheOtherObjectInArray = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); - if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObjectInArray: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_basic_array_struct_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_basic_array_struct_type_identifier( + TypeIdentifierPair& type_ids_basic_array_struct) { + + ReturnCode_t return_code_basic_array_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_basic_array_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "basic_array_struct", type_ids_basic_array_struct); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_array_struct) { StructTypeFlag struct_flags_basic_array_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_basic_array_struct; - TypeIdentifierPair type_ids_basic_array_struct; QualifiedTypeName type_name_basic_array_struct = "basic_array_struct"; eprosima::fastcdr::optional type_ann_builtin_basic_array_struct; eprosima::fastcdr::optional ann_custom_basic_array_struct; @@ -225,11 +148,13 @@ void register_basic_array_struct_type_identifier() header_basic_array_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_array_struct); CompleteStructMemberSeq member_seq_basic_array_struct; { - return_code_basic_array_struct = + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_basic_array_struct); + "_uint32_t", type_ids_index); - if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -237,48 +162,12 @@ void register_basic_array_struct_type_identifier() } StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_index; MemberId member_id_index = 0x00000000; - if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_array_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_basic_array_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_basic_array_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure index member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); return; } MemberName name_index = "index"; @@ -289,228 +178,36 @@ void register_basic_array_struct_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_basic_array_struct, member_index); } { - return_code_basic_array_struct = + TypeIdentifierPair type_ids_sub_structs; + ReturnCode_t return_code_sub_structs {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sub_structs = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_TheOtherObjectInArray_5", type_ids_basic_array_struct); + "anonymous_array_TheOtherObjectInArray_5", type_ids_sub_structs); - if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_structs) { - return_code_basic_array_struct = + return_code_sub_structs = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObjectInArray", type_ids_basic_array_struct); + "TheOtherObjectInArray", type_ids_sub_structs); - if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_structs) { - { - StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_TheOtherObjectInArray; - TypeIdentifierPair type_ids_TheOtherObjectInArray; - QualifiedTypeName type_name_TheOtherObjectInArray = "TheOtherObjectInArray"; - eprosima::fastcdr::optional type_ann_builtin_TheOtherObjectInArray; - eprosima::fastcdr::optional ann_custom_TheOtherObjectInArray; - CompleteTypeDetail detail_TheOtherObjectInArray = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObjectInArray, ann_custom_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string()); - CompleteStructHeader header_TheOtherObjectInArray; - header_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObjectInArray); - CompleteStructMemberSeq member_seq_TheOtherObjectInArray; - { - return_code_TheOtherObjectInArray = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_TheOtherObjectInArray); - - if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_some_num; - MemberId member_id_some_num = 0x00000000; - if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObjectInArray.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure some_num member TypeIdentifier inconsistent."); - return; - } - MemberName name_some_num = "some_num"; - eprosima::fastcdr::optional member_ann_builtin_some_num; - ann_custom_TheOtherObjectInArray.reset(); - CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObjectInArray); - CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); - TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_some_num); - } - { - return_code_TheOtherObjectInArray = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_TheOtherObjectInArray); - - if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_positive; - MemberId member_id_positive = 0x00000001; - if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObjectInArray.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObjectInArray.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_positive = TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, type_ids_TheOtherObjectInArray.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure positive member TypeIdentifier inconsistent."); - return; - } - MemberName name_positive = "positive"; - eprosima::fastcdr::optional member_ann_builtin_positive; - ann_custom_TheOtherObjectInArray.reset(); - CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_TheOtherObjectInArray); - CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); - TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_positive); - } - CompleteStructType struct_type_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObjectInArray, header_TheOtherObjectInArray, member_seq_TheOtherObjectInArray); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObjectInArray already registered in TypeObjectRegistry for a different type."); - } - return_code_TheOtherObjectInArray = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); - if (return_code_TheOtherObjectInArray != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObjectInArray: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_array_TheOtherObjectInArray_5 {nullptr}; - if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_array_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_array_TheOtherObjectInArray_5 = new TypeIdentifier(type_ids_basic_array_struct.type_identifier1()); + ::register_TheOtherObjectInArray_type_identifier(type_ids_sub_structs); } - else if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool element_identifier_anonymous_array_TheOtherObjectInArray_5_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_TheOtherObjectInArray_5 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_structs, element_identifier_anonymous_array_TheOtherObjectInArray_5_ec))}; + if (!element_identifier_anonymous_array_TheOtherObjectInArray_5_ec) { - element_identifier_anonymous_array_TheOtherObjectInArray_5 = new TypeIdentifier(type_ids_basic_array_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Array element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_COMPLETE; - if (TK_NONE == type_ids_basic_array_struct.type_identifier2()._d()) + if (TK_NONE == type_ids_sub_structs.type_identifier2()._d()) { equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_BOTH; } CollectionElementFlag element_flags_anonymous_array_TheOtherObjectInArray_5 = 0; PlainCollectionHeader header_anonymous_array_TheOtherObjectInArray_5 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_TheOtherObjectInArray_5, element_flags_anonymous_array_TheOtherObjectInArray_5); - std::string type_id_kind_anonymous_array_TheOtherObjectInArray_5("TI_PLAIN_ARRAY_SMALL"); - if (type_id_kind_anonymous_array_TheOtherObjectInArray_5 == "TI_PLAIN_ARRAY_SMALL") { SBoundSeq array_bound_seq; TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(5)); @@ -518,80 +215,21 @@ void register_basic_array_struct_type_identifier() PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_TheOtherObjectInArray_5, array_bound_seq, eprosima::fastcdr::external(element_identifier_anonymous_array_TheOtherObjectInArray_5)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_TheOtherObjectInArray_5")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_TheOtherObjectInArray_5 already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(5)); - - PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_TheOtherObjectInArray_5, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_TheOtherObjectInArray_5)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_TheOtherObjectInArray_5")) + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_TheOtherObjectInArray_5", type_ids_sub_structs)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_array_TheOtherObjectInArray_5 already registered in TypeObjectRegistry for a different type."); } } - return_code_basic_array_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_TheOtherObjectInArray_5", type_ids_basic_array_struct); - if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_TheOtherObjectInArray_5: Given Array TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_sub_structs = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_sub_structs; MemberId member_id_sub_structs = 0x00000001; - if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_array_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_sub_structs = TypeObjectUtils::build_common_struct_member(member_id_sub_structs, member_flags_sub_structs, type_ids_basic_array_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_array_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_array_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_array_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_sub_structs_ec {false}; + CommonStructMember common_sub_structs {TypeObjectUtils::build_common_struct_member(member_id_sub_structs, member_flags_sub_structs, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_structs, common_sub_structs_ec))}; + if (!common_sub_structs_ec) { - common_sub_structs = TypeObjectUtils::build_common_struct_member(member_id_sub_structs, member_flags_sub_structs, type_ids_basic_array_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure sub_structs member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub_structs member TypeIdentifier inconsistent."); return; } MemberName name_sub_structs = "sub_structs"; @@ -603,20 +241,11 @@ void register_basic_array_struct_type_identifier() } CompleteStructType struct_type_basic_array_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_array_struct, header_basic_array_struct, member_seq_basic_array_struct); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_array_struct, type_name_basic_array_struct.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_array_struct, type_name_basic_array_struct.to_string(), type_ids_basic_array_struct)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "basic_array_struct already registered in TypeObjectRegistry for a different type."); } - return_code_basic_array_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "basic_array_struct", type_ids_basic_array_struct); - if (return_code_basic_array_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "basic_array_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp index 6c4257e8..c6be16a7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_basic_array_struct_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,15 +42,25 @@ eProsima_user_DllExport void register_basic_array_struct_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_TheOtherObjectInArray_type_identifier(); +eProsima_user_DllExport void register_TheOtherObjectInArray_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register basic_array_struct related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_basic_array_struct_type_identifier(); +eProsima_user_DllExport void register_basic_array_struct_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx index 72df7521..62f7f479 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx @@ -219,9 +219,9 @@ bool TheOtherObjectPubSubType::getKey( return true; } -void TheOtherObjectPubSubType::register_type_object_representation() const +void TheOtherObjectPubSubType::register_type_object_representation() { - register_basic_struct_type_objects(); + register_TheOtherObject_type_identifier(type_identifiers_); } basic_structPubSubType::basic_structPubSubType() @@ -412,9 +412,9 @@ bool basic_structPubSubType::getKey( return true; } -void basic_structPubSubType::register_type_object_representation() const +void basic_structPubSubType::register_type_object_representation() { - register_basic_struct_type_objects(); + register_basic_struct_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h index 97b92306..8c5d1cdd 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h @@ -89,7 +89,7 @@ class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -180,7 +180,7 @@ class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx index ddbf4035..1d0cc939 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx @@ -38,25 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_basic_struct_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_TheOtherObject_type_identifier( + TypeIdentifierPair& type_ids_TheOtherObject) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_TheOtherObject_type_identifier(); - - register_basic_struct_type_identifier(); - - }); -} -void register_TheOtherObject_type_identifier() -{ + ReturnCode_t return_code_TheOtherObject {eprosima::fastdds::dds::RETCODE_OK}; + return_code_TheOtherObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObject", type_ids_TheOtherObject); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObject) { StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_TheOtherObject; - TypeIdentifierPair type_ids_TheOtherObject; QualifiedTypeName type_name_TheOtherObject = "TheOtherObject"; eprosima::fastcdr::optional type_ann_builtin_TheOtherObject; eprosima::fastcdr::optional ann_custom_TheOtherObject; @@ -65,11 +59,13 @@ void register_TheOtherObject_type_identifier() header_TheOtherObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObject); CompleteStructMemberSeq member_seq_TheOtherObject; { - return_code_TheOtherObject = + TypeIdentifierPair type_ids_some_num; + ReturnCode_t return_code_some_num {eprosima::fastdds::dds::RETCODE_OK}; + return_code_some_num = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_TheOtherObject); + "_int32_t", type_ids_some_num); - if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_some_num) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -77,48 +73,12 @@ void register_TheOtherObject_type_identifier() } StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_some_num; MemberId member_id_some_num = 0x00000000; - if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier2()); - } - else + bool common_some_num_ec {false}; + CommonStructMember common_some_num {TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_some_num, common_some_num_ec))}; + if (!common_some_num_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure some_num member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure some_num member TypeIdentifier inconsistent."); return; } MemberName name_some_num = "some_num"; @@ -130,29 +90,26 @@ void register_TheOtherObject_type_identifier() } CompleteStructType struct_type_TheOtherObject = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObject, header_TheOtherObject, member_seq_TheOtherObject); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObject, type_name_TheOtherObject.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObject, type_name_TheOtherObject.to_string(), type_ids_TheOtherObject)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "TheOtherObject already registered in TypeObjectRegistry for a different type."); } - return_code_TheOtherObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObject", type_ids_TheOtherObject); - if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_basic_struct_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_basic_struct_type_identifier( + TypeIdentifierPair& type_ids_basic_struct) { + + ReturnCode_t return_code_basic_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_basic_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "basic_struct", type_ids_basic_struct); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_struct) { StructTypeFlag struct_flags_basic_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_basic_struct; - TypeIdentifierPair type_ids_basic_struct; QualifiedTypeName type_name_basic_struct = "basic_struct"; eprosima::fastcdr::optional type_ann_builtin_basic_struct; eprosima::fastcdr::optional ann_custom_basic_struct; @@ -161,150 +118,24 @@ void register_basic_struct_type_identifier() header_basic_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_struct); CompleteStructMemberSeq member_seq_basic_struct; { - return_code_basic_struct = + TypeIdentifierPair type_ids_sub_struct; + ReturnCode_t return_code_sub_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sub_struct = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObject", type_ids_basic_struct); + "TheOtherObject", type_ids_sub_struct); - if (return_code_basic_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_struct) { - { - StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_TheOtherObject; - TypeIdentifierPair type_ids_TheOtherObject; - QualifiedTypeName type_name_TheOtherObject = "TheOtherObject"; - eprosima::fastcdr::optional type_ann_builtin_TheOtherObject; - eprosima::fastcdr::optional ann_custom_TheOtherObject; - CompleteTypeDetail detail_TheOtherObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObject, ann_custom_TheOtherObject, type_name_TheOtherObject.to_string()); - CompleteStructHeader header_TheOtherObject; - header_TheOtherObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObject); - CompleteStructMemberSeq member_seq_TheOtherObject; - { - return_code_TheOtherObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_TheOtherObject); - - if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_some_num; - MemberId member_id_some_num = 0x00000000; - if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1()._d() || TK_NONE == type_ids_TheOtherObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier1()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_TheOtherObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_TheOtherObject.type_identifier2()._d() && - (EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_TheOtherObject.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_some_num = TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, type_ids_TheOtherObject.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure some_num member TypeIdentifier inconsistent."); - return; - } - MemberName name_some_num = "some_num"; - eprosima::fastcdr::optional member_ann_builtin_some_num; - ann_custom_TheOtherObject.reset(); - CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObject); - CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); - TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObject, member_some_num); - } - CompleteStructType struct_type_TheOtherObject = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObject, header_TheOtherObject, member_seq_TheOtherObject); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObject, type_name_TheOtherObject.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObject already registered in TypeObjectRegistry for a different type."); - } - return_code_TheOtherObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObject", type_ids_TheOtherObject); - if (return_code_TheOtherObject != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObject: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_TheOtherObject_type_identifier(type_ids_sub_struct); } StructMemberFlag member_flags_sub_struct = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_sub_struct; MemberId member_id_sub_struct = 0x00000000; - if (EK_COMPLETE == type_ids_basic_struct.type_identifier1()._d() || TK_NONE == type_ids_basic_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_sub_struct_ec {false}; + CommonStructMember common_sub_struct {TypeObjectUtils::build_common_struct_member(member_id_sub_struct, member_flags_sub_struct, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_struct, common_sub_struct_ec))}; + if (!common_sub_struct_ec) { - common_sub_struct = TypeObjectUtils::build_common_struct_member(member_id_sub_struct, member_flags_sub_struct, type_ids_basic_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_basic_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_basic_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_basic_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_basic_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_basic_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_basic_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_basic_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_basic_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_basic_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_sub_struct = TypeObjectUtils::build_common_struct_member(member_id_sub_struct, member_flags_sub_struct, type_ids_basic_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure sub_struct member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub_struct member TypeIdentifier inconsistent."); return; } MemberName name_sub_struct = "sub_struct"; @@ -316,20 +147,11 @@ void register_basic_struct_type_identifier() } CompleteStructType struct_type_basic_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_struct, header_basic_struct, member_seq_basic_struct); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_struct, type_name_basic_struct.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_struct, type_name_basic_struct.to_string(), type_ids_basic_struct)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "basic_struct already registered in TypeObjectRegistry for a different type."); } - return_code_basic_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "basic_struct", type_ids_basic_struct); - if (return_code_basic_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "basic_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp index 37fd01e9..63cc1a64 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_basic_struct_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,15 +42,25 @@ eProsima_user_DllExport void register_basic_struct_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_TheOtherObject_type_identifier(); +eProsima_user_DllExport void register_TheOtherObject_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register basic_struct related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_basic_struct_type_identifier(); +eProsima_user_DllExport void register_basic_struct_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx index cdf53a3b..32a91178 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx @@ -219,9 +219,9 @@ bool char_sequencePubSubType::getKey( return true; } -void char_sequencePubSubType::register_type_object_representation() const +void char_sequencePubSubType::register_type_object_representation() { - register_char_sequence_type_objects(); + register_char_sequence_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h index 0567daff..c1a04da7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h @@ -89,7 +89,7 @@ class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx index 98322a9f..86259c1a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx @@ -38,23 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_char_sequence_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_char_sequence_type_identifier( + TypeIdentifierPair& type_ids_char_sequence) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_char_sequence_type_identifier(); - - }); -} -void register_char_sequence_type_identifier() -{ + ReturnCode_t return_code_char_sequence {eprosima::fastdds::dds::RETCODE_OK}; + return_code_char_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "char_sequence", type_ids_char_sequence); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_char_sequence) { StructTypeFlag struct_flags_char_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_char_sequence; - TypeIdentifierPair type_ids_char_sequence; QualifiedTypeName type_name_char_sequence = "char_sequence"; eprosima::fastcdr::optional type_ann_builtin_char_sequence; eprosima::fastcdr::optional ann_custom_char_sequence; @@ -63,151 +59,58 @@ void register_char_sequence_type_identifier() header_char_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_char_sequence); CompleteStructMemberSeq member_seq_char_sequence; { - return_code_char_sequence = + TypeIdentifierPair type_ids_chars; + ReturnCode_t return_code_chars {eprosima::fastdds::dds::RETCODE_OK}; + return_code_chars = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_char_unbounded", type_ids_char_sequence); + "anonymous_sequence_char_unbounded", type_ids_chars); - if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_chars) { - return_code_char_sequence = + return_code_chars = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_char", type_ids_char_sequence); + "_char", type_ids_chars); - if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_chars) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); return; } - TypeIdentifier* element_identifier_anonymous_sequence_char_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_char_sequence.type_identifier1()._d() || TK_NONE == type_ids_char_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_char_unbounded = new TypeIdentifier(type_ids_char_sequence.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_char_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_char_unbounded = new TypeIdentifier(type_ids_char_sequence.type_identifier2()); - } - else + bool element_identifier_anonymous_sequence_char_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_char_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_chars, element_identifier_anonymous_sequence_char_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_char_unbounded_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_char_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_char_sequence.type_identifier2()._d()) + if (TK_NONE == type_ids_chars.type_identifier2()._d()) { equiv_kind_anonymous_sequence_char_unbounded = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_char_unbounded = 0; PlainCollectionHeader header_anonymous_sequence_char_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_char_unbounded, element_flags_anonymous_sequence_char_unbounded); - std::string type_id_kind_anonymous_sequence_char_unbounded("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_char_unbounded == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = 0; PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_char_unbounded, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_char_unbounded)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_char_unbounded")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_char_unbounded", type_ids_chars)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_char_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - LBound bound = 0; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_char_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_char_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_char_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_char_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - return_code_char_sequence = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_char_unbounded", type_ids_char_sequence); - if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_char_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_chars = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_chars; MemberId member_id_chars = 0x00000000; - if (EK_COMPLETE == type_ids_char_sequence.type_identifier1()._d() || TK_NONE == type_ids_char_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_chars_ec {false}; + CommonStructMember common_chars {TypeObjectUtils::build_common_struct_member(member_id_chars, member_flags_chars, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_chars, common_chars_ec))}; + if (!common_chars_ec) { - common_chars = TypeObjectUtils::build_common_struct_member(member_id_chars, member_flags_chars, type_ids_char_sequence.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_char_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_char_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_char_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_char_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_char_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_char_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_chars = TypeObjectUtils::build_common_struct_member(member_id_chars, member_flags_chars, type_ids_char_sequence.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure chars member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure chars member TypeIdentifier inconsistent."); return; } MemberName name_chars = "chars"; @@ -219,20 +122,11 @@ void register_char_sequence_type_identifier() } CompleteStructType struct_type_char_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_char_sequence, header_char_sequence, member_seq_char_sequence); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_char_sequence, type_name_char_sequence.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_char_sequence, type_name_char_sequence.to_string(), type_ids_char_sequence)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "char_sequence already registered in TypeObjectRegistry for a different type."); } - return_code_char_sequence = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "char_sequence", type_ids_char_sequence); - if (return_code_char_sequence != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "char_sequence: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp index e3a2274f..7167bf5a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_char_sequence_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,8 +42,13 @@ eProsima_user_DllExport void register_char_sequence_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_char_sequence_type_identifier(); +eProsima_user_DllExport void register_char_sequence_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx index 5d34d150..db210aa1 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx @@ -219,9 +219,9 @@ bool ThirdLevelElementPubSubType::getKey( return true; } -void ThirdLevelElementPubSubType::register_type_object_representation() const +void ThirdLevelElementPubSubType::register_type_object_representation() { - register_complex_nested_arrays_type_objects(); + register_ThirdLevelElement_type_identifier(type_identifiers_); } SecondLevelElementPubSubType::SecondLevelElementPubSubType() @@ -412,9 +412,9 @@ bool SecondLevelElementPubSubType::getKey( return true; } -void SecondLevelElementPubSubType::register_type_object_representation() const +void SecondLevelElementPubSubType::register_type_object_representation() { - register_complex_nested_arrays_type_objects(); + register_SecondLevelElement_type_identifier(type_identifiers_); } FirstLevelElementPubSubType::FirstLevelElementPubSubType() @@ -605,9 +605,9 @@ bool FirstLevelElementPubSubType::getKey( return true; } -void FirstLevelElementPubSubType::register_type_object_representation() const +void FirstLevelElementPubSubType::register_type_object_representation() { - register_complex_nested_arrays_type_objects(); + register_FirstLevelElement_type_identifier(type_identifiers_); } complex_nested_arraysPubSubType::complex_nested_arraysPubSubType() @@ -798,9 +798,9 @@ bool complex_nested_arraysPubSubType::getKey( return true; } -void complex_nested_arraysPubSubType::register_type_object_representation() const +void complex_nested_arraysPubSubType::register_type_object_representation() { - register_complex_nested_arrays_type_objects(); + register_complex_nested_arrays_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h index 98c032f8..119b0206 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h @@ -89,7 +89,7 @@ class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -180,7 +180,7 @@ class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataTyp void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -271,7 +271,7 @@ class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override @@ -362,7 +362,7 @@ class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicData void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx index 2791acb9..d60a7f72 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx @@ -38,29 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_complex_nested_arrays_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_ThirdLevelElement_type_identifier( + TypeIdentifierPair& type_ids_ThirdLevelElement) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_ThirdLevelElement_type_identifier(); - - register_SecondLevelElement_type_identifier(); - - register_FirstLevelElement_type_identifier(); - - register_complex_nested_arrays_type_identifier(); - - }); -} -void register_ThirdLevelElement_type_identifier() -{ + ReturnCode_t return_code_ThirdLevelElement {eprosima::fastdds::dds::RETCODE_OK}; + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_ThirdLevelElement) { StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; eprosima::fastcdr::optional ann_custom_ThirdLevelElement; @@ -69,11 +59,13 @@ void register_ThirdLevelElement_type_identifier() header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); CompleteStructMemberSeq member_seq_ThirdLevelElement; { - return_code_ThirdLevelElement = + TypeIdentifierPair type_ids_x; + ReturnCode_t return_code_x {eprosima::fastdds::dds::RETCODE_OK}; + return_code_x = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); + "_double", type_ids_x); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_x) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -81,48 +73,12 @@ void register_ThirdLevelElement_type_identifier() } StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_x; MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_x_ec {false}; + CommonStructMember common_x {TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_x, common_x_ec))}; + if (!common_x_ec) { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure x member TypeIdentifier inconsistent."); return; } MemberName name_x = "x"; @@ -133,11 +89,13 @@ void register_ThirdLevelElement_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); } { - return_code_ThirdLevelElement = + TypeIdentifierPair type_ids_y; + ReturnCode_t return_code_y {eprosima::fastdds::dds::RETCODE_OK}; + return_code_y = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); + "_double", type_ids_y); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_y) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -145,48 +103,12 @@ void register_ThirdLevelElement_type_identifier() } StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_y; MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_y_ec {false}; + CommonStructMember common_y {TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_y, common_y_ec))}; + if (!common_y_ec) { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure y member TypeIdentifier inconsistent."); return; } MemberName name_y = "y"; @@ -198,29 +120,26 @@ void register_ThirdLevelElement_type_identifier() } CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string(), type_ids_ThirdLevelElement)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_SecondLevelElement_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_SecondLevelElement_type_identifier( + TypeIdentifierPair& type_ids_SecondLevelElement) { + + ReturnCode_t return_code_SecondLevelElement {eprosima::fastdds::dds::RETCODE_OK}; + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_SecondLevelElement); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_SecondLevelElement) { StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_SecondLevelElement; - TypeIdentifierPair type_ids_SecondLevelElement; QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; eprosima::fastcdr::optional ann_custom_SecondLevelElement; @@ -229,214 +148,24 @@ void register_SecondLevelElement_type_identifier() header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); CompleteStructMemberSeq member_seq_SecondLevelElement; { - return_code_SecondLevelElement = + TypeIdentifierPair type_ids_an_element_alone; + ReturnCode_t return_code_an_element_alone {eprosima::fastdds::dds::RETCODE_OK}; + return_code_an_element_alone = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_SecondLevelElement); + "ThirdLevelElement", type_ids_an_element_alone); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_an_element_alone) { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); } StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_an_element_alone; MemberId member_id_an_element_alone = 0x00000000; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_an_element_alone_ec {false}; + CommonStructMember common_an_element_alone {TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_an_element_alone, common_an_element_alone_ec))}; + if (!common_an_element_alone_ec) { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure an_element_alone member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure an_element_alone member TypeIdentifier inconsistent."); return; } MemberName name_an_element_alone = "an_element_alone"; @@ -447,305 +176,56 @@ void register_SecondLevelElement_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); } { - return_code_SecondLevelElement = + TypeIdentifierPair type_ids_a_limited_other_value; + ReturnCode_t return_code_a_limited_other_value {eprosima::fastdds::dds::RETCODE_OK}; + return_code_a_limited_other_value = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); + "anonymous_sequence_ThirdLevelElement_1", type_ids_a_limited_other_value); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_a_limited_other_value) { - return_code_SecondLevelElement = + return_code_a_limited_other_value = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_SecondLevelElement); + "ThirdLevelElement", type_ids_a_limited_other_value); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {nullptr}; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_a_limited_other_value) { - element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier2()); + ::register_ThirdLevelElement_type_identifier(type_ids_a_limited_other_value); } - else + bool element_identifier_anonymous_sequence_ThirdLevelElement_1_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_a_limited_other_value, element_identifier_anonymous_sequence_ThirdLevelElement_1_ec))}; + if (!element_identifier_anonymous_sequence_ThirdLevelElement_1_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; - if (TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d()) + if (TK_NONE == type_ids_a_limited_other_value.type_identifier2()._d()) { equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); - std::string type_id_kind_anonymous_sequence_ThirdLevelElement_1("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_ThirdLevelElement_1 == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = static_cast(1); PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 1; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_ThirdLevelElement_1")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1", type_ids_a_limited_other_value)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); } } - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_a_limited_other_value; MemberId member_id_a_limited_other_value = 0x00000001; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_a_limited_other_value_ec {false}; + CommonStructMember common_a_limited_other_value {TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_a_limited_other_value, common_a_limited_other_value_ec))}; + if (!common_a_limited_other_value_ec) { - common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure a_limited_other_value member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure a_limited_other_value member TypeIdentifier inconsistent."); return; } MemberName name_a_limited_other_value = "a_limited_other_value"; @@ -757,29 +237,26 @@ void register_SecondLevelElement_type_identifier() } CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string(), type_ids_SecondLevelElement)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "SecondLevelElement already registered in TypeObjectRegistry for a different type."); } - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "SecondLevelElement", type_ids_SecondLevelElement); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "SecondLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_FirstLevelElement_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_FirstLevelElement_type_identifier( + TypeIdentifierPair& type_ids_FirstLevelElement) { + + ReturnCode_t return_code_FirstLevelElement {eprosima::fastdds::dds::RETCODE_OK}; + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "FirstLevelElement", type_ids_FirstLevelElement); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_FirstLevelElement) { StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_FirstLevelElement; - TypeIdentifierPair type_ids_FirstLevelElement; QualifiedTypeName type_name_FirstLevelElement = "FirstLevelElement"; eprosima::fastcdr::optional type_ann_builtin_FirstLevelElement; eprosima::fastcdr::optional ann_custom_FirstLevelElement; @@ -788,97 +265,34 @@ void register_FirstLevelElement_type_identifier() header_FirstLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_FirstLevelElement); CompleteStructMemberSeq member_seq_FirstLevelElement; { - return_code_FirstLevelElement = + TypeIdentifierPair type_ids_useless_name; + ReturnCode_t return_code_useless_name {eprosima::fastdds::dds::RETCODE_OK}; + return_code_useless_name = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_FirstLevelElement); + "anonymous_string_unbounded", type_ids_useless_name); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_useless_name) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_useless_name)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_FirstLevelElement); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_useless_name; MemberId member_id_useless_name = 0x00000000; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_useless_name_ec {false}; + CommonStructMember common_useless_name {TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_useless_name, common_useless_name_ec))}; + if (!common_useless_name_ec) { - common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure useless_name member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure useless_name member TypeIdentifier inconsistent."); return; } MemberName name_useless_name = "useless_name"; @@ -889,704 +303,56 @@ void register_FirstLevelElement_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_useless_name); } { - return_code_FirstLevelElement = + TypeIdentifierPair type_ids_sub; + ReturnCode_t return_code_sub {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sub = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); + "anonymous_sequence_SecondLevelElement_unbounded", type_ids_sub); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub) { - return_code_FirstLevelElement = + return_code_sub = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "SecondLevelElement", type_ids_FirstLevelElement); + "SecondLevelElement", type_ids_sub); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub) { - { - StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_SecondLevelElement; - TypeIdentifierPair type_ids_SecondLevelElement; - QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; - eprosima::fastcdr::optional ann_custom_SecondLevelElement; - CompleteTypeDetail detail_SecondLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SecondLevelElement, ann_custom_SecondLevelElement, type_name_SecondLevelElement.to_string()); - CompleteStructHeader header_SecondLevelElement; - header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); - CompleteStructMemberSeq member_seq_SecondLevelElement; - { - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_SecondLevelElement); - - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_an_element_alone; - MemberId member_id_an_element_alone = 0x00000000; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure an_element_alone member TypeIdentifier inconsistent."); - return; - } - MemberName name_an_element_alone = "an_element_alone"; - eprosima::fastcdr::optional member_ann_builtin_an_element_alone; - ann_custom_SecondLevelElement.reset(); - CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_SecondLevelElement); - CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); - TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); - } - { - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); - - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_SecondLevelElement); - - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {nullptr}; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; - if (TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; - PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); - std::string type_id_kind_anonymous_sequence_ThirdLevelElement_1("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_ThirdLevelElement_1 == "TI_PLAIN_SEQUENCE_SMALL") - { - SBound bound = static_cast(1); - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 1; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_ThirdLevelElement_1")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); - } - } - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_a_limited_other_value; - MemberId member_id_a_limited_other_value = 0x00000001; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure a_limited_other_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_a_limited_other_value = "a_limited_other_value"; - eprosima::fastcdr::optional member_ann_builtin_a_limited_other_value; - ann_custom_SecondLevelElement.reset(); - CompleteMemberDetail detail_a_limited_other_value = TypeObjectUtils::build_complete_member_detail(name_a_limited_other_value, member_ann_builtin_a_limited_other_value, ann_custom_SecondLevelElement); - CompleteStructMember member_a_limited_other_value = TypeObjectUtils::build_complete_struct_member(common_a_limited_other_value, detail_a_limited_other_value); - TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_a_limited_other_value); - } - CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "SecondLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "SecondLevelElement", type_ids_SecondLevelElement); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "SecondLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_SecondLevelElement_type_identifier(type_ids_sub); } - TypeIdentifier* element_identifier_anonymous_sequence_SecondLevelElement_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_SecondLevelElement_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub, element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec) { - element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d()) + if (TK_NONE == type_ids_sub.type_identifier2()._d()) { equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_SecondLevelElement_unbounded = 0; PlainCollectionHeader header_anonymous_sequence_SecondLevelElement_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_SecondLevelElement_unbounded, element_flags_anonymous_sequence_SecondLevelElement_unbounded); - std::string type_id_kind_anonymous_sequence_SecondLevelElement_unbounded("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_SecondLevelElement_unbounded == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = 0; PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_SecondLevelElement_unbounded")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_SecondLevelElement_unbounded", type_ids_sub)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - LBound bound = 0; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_SecondLevelElement_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_SecondLevelElement_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_sub; MemberId member_id_sub = 0x00000001; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier2()); - } - else + bool common_sub_ec {false}; + CommonStructMember common_sub {TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub, common_sub_ec))}; + if (!common_sub_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure sub member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub member TypeIdentifier inconsistent."); return; } MemberName name_sub = "sub"; @@ -1597,214 +363,24 @@ void register_FirstLevelElement_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_sub); } { - return_code_FirstLevelElement = + TypeIdentifierPair type_ids_an_element_alone; + ReturnCode_t return_code_an_element_alone {eprosima::fastdds::dds::RETCODE_OK}; + return_code_an_element_alone = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_FirstLevelElement); + "ThirdLevelElement", type_ids_an_element_alone); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_an_element_alone) { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); } StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_an_element_alone; MemberId member_id_an_element_alone = 0x00000002; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier2()); - } - else + bool common_an_element_alone_ec {false}; + CommonStructMember common_an_element_alone {TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_an_element_alone, common_an_element_alone_ec))}; + if (!common_an_element_alone_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure an_element_alone member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure an_element_alone member TypeIdentifier inconsistent."); return; } MemberName name_an_element_alone = "an_element_alone"; @@ -1816,29 +392,26 @@ void register_FirstLevelElement_type_identifier() } CompleteStructType struct_type_FirstLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_FirstLevelElement, header_FirstLevelElement, member_seq_FirstLevelElement); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_FirstLevelElement, type_name_FirstLevelElement.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_FirstLevelElement, type_name_FirstLevelElement.to_string(), type_ids_FirstLevelElement)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "FirstLevelElement already registered in TypeObjectRegistry for a different type."); } - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "FirstLevelElement", type_ids_FirstLevelElement); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "FirstLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_complex_nested_arrays_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_complex_nested_arrays_type_identifier( + TypeIdentifierPair& type_ids_complex_nested_arrays) { + + ReturnCode_t return_code_complex_nested_arrays {eprosima::fastdds::dds::RETCODE_OK}; + return_code_complex_nested_arrays = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "complex_nested_arrays", type_ids_complex_nested_arrays); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_complex_nested_arrays) { StructTypeFlag struct_flags_complex_nested_arrays = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_complex_nested_arrays; - TypeIdentifierPair type_ids_complex_nested_arrays; QualifiedTypeName type_name_complex_nested_arrays = "complex_nested_arrays"; eprosima::fastcdr::optional type_ann_builtin_complex_nested_arrays; eprosima::fastcdr::optional ann_custom_complex_nested_arrays; @@ -1847,1127 +420,36 @@ void register_complex_nested_arrays_type_identifier() header_complex_nested_arrays = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_complex_nested_arrays); CompleteStructMemberSeq member_seq_complex_nested_arrays; { - return_code_complex_nested_arrays = + TypeIdentifierPair type_ids_array_of_elements; + ReturnCode_t return_code_array_of_elements {eprosima::fastdds::dds::RETCODE_OK}; + return_code_array_of_elements = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_FirstLevelElement_3", type_ids_complex_nested_arrays); + "anonymous_array_FirstLevelElement_3", type_ids_array_of_elements); - if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_array_of_elements) { - return_code_complex_nested_arrays = + return_code_array_of_elements = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "FirstLevelElement", type_ids_complex_nested_arrays); + "FirstLevelElement", type_ids_array_of_elements); - if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_array_of_elements) { - { - StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_FirstLevelElement; - TypeIdentifierPair type_ids_FirstLevelElement; - QualifiedTypeName type_name_FirstLevelElement = "FirstLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_FirstLevelElement; - eprosima::fastcdr::optional ann_custom_FirstLevelElement; - CompleteTypeDetail detail_FirstLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_FirstLevelElement, ann_custom_FirstLevelElement, type_name_FirstLevelElement.to_string()); - CompleteStructHeader header_FirstLevelElement; - header_FirstLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_FirstLevelElement); - CompleteStructMemberSeq member_seq_FirstLevelElement; - { - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_FirstLevelElement); - - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_FirstLevelElement); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_useless_name; - MemberId member_id_useless_name = 0x00000000; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_useless_name = TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, type_ids_FirstLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure useless_name member TypeIdentifier inconsistent."); - return; - } - MemberName name_useless_name = "useless_name"; - eprosima::fastcdr::optional member_ann_builtin_useless_name; - ann_custom_FirstLevelElement.reset(); - CompleteMemberDetail detail_useless_name = TypeObjectUtils::build_complete_member_detail(name_useless_name, member_ann_builtin_useless_name, ann_custom_FirstLevelElement); - CompleteStructMember member_useless_name = TypeObjectUtils::build_complete_struct_member(common_useless_name, detail_useless_name); - TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_useless_name); - } - { - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); - - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "SecondLevelElement", type_ids_FirstLevelElement); - - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_SecondLevelElement; - TypeIdentifierPair type_ids_SecondLevelElement; - QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; - eprosima::fastcdr::optional ann_custom_SecondLevelElement; - CompleteTypeDetail detail_SecondLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SecondLevelElement, ann_custom_SecondLevelElement, type_name_SecondLevelElement.to_string()); - CompleteStructHeader header_SecondLevelElement; - header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); - CompleteStructMemberSeq member_seq_SecondLevelElement; - { - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_SecondLevelElement); - - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_an_element_alone; - MemberId member_id_an_element_alone = 0x00000000; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure an_element_alone member TypeIdentifier inconsistent."); - return; - } - MemberName name_an_element_alone = "an_element_alone"; - eprosima::fastcdr::optional member_ann_builtin_an_element_alone; - ann_custom_SecondLevelElement.reset(); - CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_SecondLevelElement); - CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); - TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); - } - { - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); - - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_SecondLevelElement); - - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {nullptr}; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_ThirdLevelElement_1 = new TypeIdentifier(type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; - if (TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; - PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); - std::string type_id_kind_anonymous_sequence_ThirdLevelElement_1("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_ThirdLevelElement_1 == "TI_PLAIN_SEQUENCE_SMALL") - { - SBound bound = static_cast(1); - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 1; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_ThirdLevelElement_1")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); - } - } - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_ThirdLevelElement_1", type_ids_SecondLevelElement); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_a_limited_other_value; - MemberId member_id_a_limited_other_value = 0x00000001; - if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1()._d() || TK_NONE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_SecondLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_SecondLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_a_limited_other_value = TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, type_ids_SecondLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure a_limited_other_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_a_limited_other_value = "a_limited_other_value"; - eprosima::fastcdr::optional member_ann_builtin_a_limited_other_value; - ann_custom_SecondLevelElement.reset(); - CompleteMemberDetail detail_a_limited_other_value = TypeObjectUtils::build_complete_member_detail(name_a_limited_other_value, member_ann_builtin_a_limited_other_value, ann_custom_SecondLevelElement); - CompleteStructMember member_a_limited_other_value = TypeObjectUtils::build_complete_struct_member(common_a_limited_other_value, detail_a_limited_other_value); - TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_a_limited_other_value); - } - CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "SecondLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "SecondLevelElement", type_ids_SecondLevelElement); - if (return_code_SecondLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "SecondLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - TypeIdentifier* element_identifier_anonymous_sequence_SecondLevelElement_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_SecondLevelElement_unbounded = new TypeIdentifier(type_ids_FirstLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_SecondLevelElement_unbounded = 0; - PlainCollectionHeader header_anonymous_sequence_SecondLevelElement_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_SecondLevelElement_unbounded, element_flags_anonymous_sequence_SecondLevelElement_unbounded); - std::string type_id_kind_anonymous_sequence_SecondLevelElement_unbounded("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_SecondLevelElement_unbounded == "TI_PLAIN_SEQUENCE_SMALL") - { - SBound bound = 0; - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_SecondLevelElement_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 0; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_SecondLevelElement_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_SecondLevelElement_unbounded", type_ids_FirstLevelElement); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_SecondLevelElement_unbounded: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_sub; - MemberId member_id_sub = 0x00000001; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_sub = TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, type_ids_FirstLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure sub member TypeIdentifier inconsistent."); - return; - } - MemberName name_sub = "sub"; - eprosima::fastcdr::optional member_ann_builtin_sub; - ann_custom_FirstLevelElement.reset(); - CompleteMemberDetail detail_sub = TypeObjectUtils::build_complete_member_detail(name_sub, member_ann_builtin_sub, ann_custom_FirstLevelElement); - CompleteStructMember member_sub = TypeObjectUtils::build_complete_struct_member(common_sub, detail_sub); - TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_sub); - } - { - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_FirstLevelElement); - - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - ReturnCode_t return_code_ThirdLevelElement; - TypeIdentifierPair type_ids_ThirdLevelElement; - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_x; - MemberId member_id_x = 0x00000000; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_x = TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_ThirdLevelElement); - - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_y; - MemberId member_id_y = 0x00000001; - if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1()._d() || TK_NONE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_ThirdLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_ThirdLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_y = TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, type_ids_ThirdLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (return_code_ThirdLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - } - StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false, false, false); - CommonStructMember common_an_element_alone; - MemberId member_id_an_element_alone = 0x00000002; - if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1()._d() || TK_NONE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier1()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_FirstLevelElement.type_identifier2()._d() && - (EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_FirstLevelElement.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_an_element_alone = TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, type_ids_FirstLevelElement.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure an_element_alone member TypeIdentifier inconsistent."); - return; - } - MemberName name_an_element_alone = "an_element_alone"; - eprosima::fastcdr::optional member_ann_builtin_an_element_alone; - ann_custom_FirstLevelElement.reset(); - CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_FirstLevelElement); - CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); - TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_an_element_alone); - } - CompleteStructType struct_type_FirstLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_FirstLevelElement, header_FirstLevelElement, member_seq_FirstLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_FirstLevelElement, type_name_FirstLevelElement.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "FirstLevelElement already registered in TypeObjectRegistry for a different type."); - } - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "FirstLevelElement", type_ids_FirstLevelElement); - if (return_code_FirstLevelElement != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "FirstLevelElement: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_FirstLevelElement_type_identifier(type_ids_array_of_elements); } - TypeIdentifier* element_identifier_anonymous_array_FirstLevelElement_3 {nullptr}; - if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1()._d() || TK_NONE == type_ids_complex_nested_arrays.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool element_identifier_anonymous_array_FirstLevelElement_3_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_FirstLevelElement_3 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_array_of_elements, element_identifier_anonymous_array_FirstLevelElement_3_ec))}; + if (!element_identifier_anonymous_array_FirstLevelElement_3_ec) { - element_identifier_anonymous_array_FirstLevelElement_3 = new TypeIdentifier(type_ids_complex_nested_arrays.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_array_FirstLevelElement_3 = new TypeIdentifier(type_ids_complex_nested_arrays.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Array element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_array_FirstLevelElement_3 = EK_COMPLETE; - if (TK_NONE == type_ids_complex_nested_arrays.type_identifier2()._d()) + if (TK_NONE == type_ids_array_of_elements.type_identifier2()._d()) { equiv_kind_anonymous_array_FirstLevelElement_3 = EK_BOTH; } CollectionElementFlag element_flags_anonymous_array_FirstLevelElement_3 = 0; PlainCollectionHeader header_anonymous_array_FirstLevelElement_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_FirstLevelElement_3, element_flags_anonymous_array_FirstLevelElement_3); - std::string type_id_kind_anonymous_array_FirstLevelElement_3("TI_PLAIN_ARRAY_SMALL"); - if (type_id_kind_anonymous_array_FirstLevelElement_3 == "TI_PLAIN_ARRAY_SMALL") { SBoundSeq array_bound_seq; TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); @@ -2975,80 +457,21 @@ void register_complex_nested_arrays_type_identifier() PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_FirstLevelElement_3, array_bound_seq, eprosima::fastcdr::external(element_identifier_anonymous_array_FirstLevelElement_3)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_FirstLevelElement_3")) + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_FirstLevelElement_3", type_ids_array_of_elements)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_array_FirstLevelElement_3 already registered in TypeObjectRegistry for a different type."); } } - else - { - LBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); - - PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_FirstLevelElement_3, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_FirstLevelElement_3)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_FirstLevelElement_3")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_FirstLevelElement_3 already registered in TypeObjectRegistry for a different type."); - } - } - return_code_complex_nested_arrays = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_FirstLevelElement_3", type_ids_complex_nested_arrays); - if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_FirstLevelElement_3: Given Array TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_array_of_elements = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_array_of_elements; MemberId member_id_array_of_elements = 0x00000000; - if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1()._d() || TK_NONE == type_ids_complex_nested_arrays.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier1()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier1()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_array_of_elements_ec {false}; + CommonStructMember common_array_of_elements {TypeObjectUtils::build_common_struct_member(member_id_array_of_elements, member_flags_array_of_elements, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_array_of_elements, common_array_of_elements_ec))}; + if (!common_array_of_elements_ec) { - common_array_of_elements = TypeObjectUtils::build_common_struct_member(member_id_array_of_elements, member_flags_array_of_elements, type_ids_complex_nested_arrays.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_complex_nested_arrays.type_identifier2()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_complex_nested_arrays.type_identifier2()._d() && - (EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_complex_nested_arrays.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_array_of_elements = TypeObjectUtils::build_common_struct_member(member_id_array_of_elements, member_flags_array_of_elements, type_ids_complex_nested_arrays.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure array_of_elements member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure array_of_elements member TypeIdentifier inconsistent."); return; } MemberName name_array_of_elements = "array_of_elements"; @@ -3060,20 +483,11 @@ void register_complex_nested_arrays_type_identifier() } CompleteStructType struct_type_complex_nested_arrays = TypeObjectUtils::build_complete_struct_type(struct_flags_complex_nested_arrays, header_complex_nested_arrays, member_seq_complex_nested_arrays); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_complex_nested_arrays, type_name_complex_nested_arrays.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_complex_nested_arrays, type_name_complex_nested_arrays.to_string(), type_ids_complex_nested_arrays)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "complex_nested_arrays already registered in TypeObjectRegistry for a different type."); } - return_code_complex_nested_arrays = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "complex_nested_arrays", type_ids_complex_nested_arrays); - if (return_code_complex_nested_arrays != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "complex_nested_arrays: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp index 756845d0..b575368d 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_complex_nested_arrays_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,29 +42,49 @@ eProsima_user_DllExport void register_complex_nested_arrays_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_ThirdLevelElement_type_identifier(); +eProsima_user_DllExport void register_ThirdLevelElement_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register SecondLevelElement related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_SecondLevelElement_type_identifier(); +eProsima_user_DllExport void register_SecondLevelElement_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register FirstLevelElement related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_FirstLevelElement_type_identifier(); +eProsima_user_DllExport void register_FirstLevelElement_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register complex_nested_arrays related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_complex_nested_arrays_type_identifier(); +eProsima_user_DllExport void register_complex_nested_arrays_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx index cf595921..507c74a2 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx @@ -219,9 +219,9 @@ bool enum_structPubSubType::getKey( return true; } -void enum_structPubSubType::register_type_object_representation() const +void enum_structPubSubType::register_type_object_representation() { - register_enum_struct_type_objects(); + register_enum_struct_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h index a2a1a99e..dfade420 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h @@ -89,7 +89,7 @@ class enum_structPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx index e87ecad5..22969762 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx @@ -38,23 +38,76 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_enum_struct_type_objects() +void register_ColorEnum_type_identifier( + TypeIdentifierPair& type_ids_ColorEnum) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_enum_struct_type_identifier(); - - }); -} - -void register_enum_struct_type_identifier() + ReturnCode_t return_code_ColorEnum {eprosima::fastdds::dds::RETCODE_OK}; + return_code_ColorEnum = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ColorEnum", type_ids_ColorEnum); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_ColorEnum) + { + EnumTypeFlag enum_flags_ColorEnum = 0; + BitBound bit_bound_ColorEnum = 32; + CommonEnumeratedHeader common_ColorEnum = TypeObjectUtils::build_common_enumerated_header(bit_bound_ColorEnum); + QualifiedTypeName type_name_ColorEnum = "ColorEnum"; + eprosima::fastcdr::optional type_ann_builtin_ColorEnum; + eprosima::fastcdr::optional ann_custom_ColorEnum; + CompleteTypeDetail detail_ColorEnum = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ColorEnum, ann_custom_ColorEnum, type_name_ColorEnum.to_string()); + CompleteEnumeratedHeader header_ColorEnum = TypeObjectUtils::build_complete_enumerated_header(common_ColorEnum, detail_ColorEnum); + CompleteEnumeratedLiteralSeq literal_seq_ColorEnum; + { + EnumeratedLiteralFlag flags_RED = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_RED = TypeObjectUtils::build_common_enumerated_literal(0, flags_RED); + eprosima::fastcdr::optional member_ann_builtin_RED; + ann_custom_ColorEnum.reset(); + MemberName name_RED = "RED"; + CompleteMemberDetail detail_RED = TypeObjectUtils::build_complete_member_detail(name_RED, member_ann_builtin_RED, ann_custom_ColorEnum); + CompleteEnumeratedLiteral literal_RED = TypeObjectUtils::build_complete_enumerated_literal(common_RED, detail_RED); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_RED); + } + { + EnumeratedLiteralFlag flags_GREEN = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_GREEN = TypeObjectUtils::build_common_enumerated_literal(1, flags_GREEN); + eprosima::fastcdr::optional member_ann_builtin_GREEN; + ann_custom_ColorEnum.reset(); + MemberName name_GREEN = "GREEN"; + CompleteMemberDetail detail_GREEN = TypeObjectUtils::build_complete_member_detail(name_GREEN, member_ann_builtin_GREEN, ann_custom_ColorEnum); + CompleteEnumeratedLiteral literal_GREEN = TypeObjectUtils::build_complete_enumerated_literal(common_GREEN, detail_GREEN); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_GREEN); + } + { + EnumeratedLiteralFlag flags_BLUE = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_BLUE = TypeObjectUtils::build_common_enumerated_literal(2, flags_BLUE); + eprosima::fastcdr::optional member_ann_builtin_BLUE; + ann_custom_ColorEnum.reset(); + MemberName name_BLUE = "BLUE"; + CompleteMemberDetail detail_BLUE = TypeObjectUtils::build_complete_member_detail(name_BLUE, member_ann_builtin_BLUE, ann_custom_ColorEnum); + CompleteEnumeratedLiteral literal_BLUE = TypeObjectUtils::build_complete_enumerated_literal(common_BLUE, detail_BLUE); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_BLUE); + } + CompleteEnumeratedType enumerated_type_ColorEnum = TypeObjectUtils::build_complete_enumerated_type(enum_flags_ColorEnum, header_ColorEnum, + literal_seq_ColorEnum); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_ColorEnum, type_name_ColorEnum.to_string(), type_ids_ColorEnum)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ColorEnum already registered in TypeObjectRegistry for a different type."); + } + } +}// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_enum_struct_type_identifier( + TypeIdentifierPair& type_ids_enum_struct) { + + ReturnCode_t return_code_enum_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_enum_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "enum_struct", type_ids_enum_struct); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_enum_struct) { StructTypeFlag struct_flags_enum_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_enum_struct; - TypeIdentifierPair type_ids_enum_struct; QualifiedTypeName type_name_enum_struct = "enum_struct"; eprosima::fastcdr::optional type_ann_builtin_enum_struct; eprosima::fastcdr::optional ann_custom_enum_struct; @@ -63,11 +116,13 @@ void register_enum_struct_type_identifier() header_enum_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_enum_struct); CompleteStructMemberSeq member_seq_enum_struct; { - return_code_enum_struct = + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_enum_struct); + "_uint32_t", type_ids_index); - if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -75,48 +130,12 @@ void register_enum_struct_type_identifier() } StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_index; MemberId member_id_index = 0x00000000; - if (EK_COMPLETE == type_ids_enum_struct.type_identifier1()._d() || TK_NONE == type_ids_enum_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_enum_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_enum_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_enum_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure index member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); return; } MemberName name_index = "index"; @@ -127,113 +146,24 @@ void register_enum_struct_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_enum_struct, member_index); } { - return_code_enum_struct = + TypeIdentifierPair type_ids_enum_value; + ReturnCode_t return_code_enum_value {eprosima::fastdds::dds::RETCODE_OK}; + return_code_enum_value = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ColorEnum", type_ids_enum_struct); + "ColorEnum", type_ids_enum_value); - if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_enum_value) { - EnumTypeFlag enum_flags_ColorEnum = 0; - BitBound bit_bound_ColorEnum = 32; - CommonEnumeratedHeader common_ColorEnum = TypeObjectUtils::build_common_enumerated_header(bit_bound_ColorEnum); - QualifiedTypeName type_name_ColorEnum = "ColorEnum"; - eprosima::fastcdr::optional type_ann_builtin_ColorEnum; - eprosima::fastcdr::optional ann_custom_ColorEnum; - CompleteTypeDetail detail_ColorEnum = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ColorEnum, ann_custom_ColorEnum, type_name_ColorEnum.to_string()); - CompleteEnumeratedHeader header_ColorEnum = TypeObjectUtils::build_complete_enumerated_header(common_ColorEnum, detail_ColorEnum); - CompleteEnumeratedLiteralSeq literal_seq_ColorEnum; - { - EnumeratedLiteralFlag flags_RED = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_RED = TypeObjectUtils::build_common_enumerated_literal(0, flags_RED); - eprosima::fastcdr::optional member_ann_builtin_RED; - ann_custom_ColorEnum.reset(); - MemberName name_RED = "RED"; - CompleteMemberDetail detail_RED = TypeObjectUtils::build_complete_member_detail(name_RED, member_ann_builtin_RED, ann_custom_ColorEnum); - CompleteEnumeratedLiteral literal_RED = TypeObjectUtils::build_complete_enumerated_literal(common_RED, detail_RED); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_RED); - } - { - EnumeratedLiteralFlag flags_GREEN = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_GREEN = TypeObjectUtils::build_common_enumerated_literal(1, flags_GREEN); - eprosima::fastcdr::optional member_ann_builtin_GREEN; - ann_custom_ColorEnum.reset(); - MemberName name_GREEN = "GREEN"; - CompleteMemberDetail detail_GREEN = TypeObjectUtils::build_complete_member_detail(name_GREEN, member_ann_builtin_GREEN, ann_custom_ColorEnum); - CompleteEnumeratedLiteral literal_GREEN = TypeObjectUtils::build_complete_enumerated_literal(common_GREEN, detail_GREEN); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_GREEN); - } - { - EnumeratedLiteralFlag flags_BLUE = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_BLUE = TypeObjectUtils::build_common_enumerated_literal(2, flags_BLUE); - eprosima::fastcdr::optional member_ann_builtin_BLUE; - ann_custom_ColorEnum.reset(); - MemberName name_BLUE = "BLUE"; - CompleteMemberDetail detail_BLUE = TypeObjectUtils::build_complete_member_detail(name_BLUE, member_ann_builtin_BLUE, ann_custom_ColorEnum); - CompleteEnumeratedLiteral literal_BLUE = TypeObjectUtils::build_complete_enumerated_literal(common_BLUE, detail_BLUE); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_BLUE); - } - CompleteEnumeratedType enumerated_type_ColorEnum = TypeObjectUtils::build_complete_enumerated_type(enum_flags_ColorEnum, header_ColorEnum, - literal_seq_ColorEnum); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_ColorEnum, type_name_ColorEnum.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ColorEnum already registered in TypeObjectRegistry for a different type."); - } - return_code_enum_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ColorEnum", type_ids_enum_struct); - if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ColorEnum: Given Enum TypeIdentifier unknown to TypeObjectRegistry."); - return; - } + ::register_ColorEnum_type_identifier(type_ids_enum_value); } StructMemberFlag member_flags_enum_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_enum_value; MemberId member_id_enum_value = 0x00000001; - if (EK_COMPLETE == type_ids_enum_struct.type_identifier1()._d() || TK_NONE == type_ids_enum_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_enum_value_ec {false}; + CommonStructMember common_enum_value {TypeObjectUtils::build_common_struct_member(member_id_enum_value, member_flags_enum_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_enum_value, common_enum_value_ec))}; + if (!common_enum_value_ec) { - common_enum_value = TypeObjectUtils::build_common_struct_member(member_id_enum_value, member_flags_enum_value, type_ids_enum_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_enum_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_enum_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_enum_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_enum_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_enum_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_enum_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_enum_value = TypeObjectUtils::build_common_struct_member(member_id_enum_value, member_flags_enum_value, type_ids_enum_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure enum_value member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure enum_value member TypeIdentifier inconsistent."); return; } MemberName name_enum_value = "enum_value"; @@ -245,20 +175,11 @@ void register_enum_struct_type_identifier() } CompleteStructType struct_type_enum_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_enum_struct, header_enum_struct, member_seq_enum_struct); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_enum_struct, type_name_enum_struct.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_enum_struct, type_name_enum_struct.to_string(), type_ids_enum_struct)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "enum_struct already registered in TypeObjectRegistry for a different type."); } - return_code_enum_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "enum_struct", type_ids_enum_struct); - if (return_code_enum_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "enum_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp index ca4873c2..288179a2 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,20 +35,32 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_enum_struct_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +/** + * @brief Register ColorEnum related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_ColorEnum_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register enum_struct related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_enum_struct_type_identifier(); +eProsima_user_DllExport void register_enum_struct_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx index 1aea39f7..09d0d203 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx @@ -219,9 +219,9 @@ bool float_bounded_sequencePubSubType::getKey( return true; } -void float_bounded_sequencePubSubType::register_type_object_representation() const +void float_bounded_sequencePubSubType::register_type_object_representation() { - register_float_bounded_sequence_type_objects(); + register_float_bounded_sequence_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h index 9ce67a10..2764b766 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h @@ -89,7 +89,7 @@ class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDat void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx index 466dba67..01905db3 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx @@ -38,23 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_float_bounded_sequence_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_float_bounded_sequence_type_identifier( + TypeIdentifierPair& type_ids_float_bounded_sequence) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_float_bounded_sequence_type_identifier(); - - }); -} -void register_float_bounded_sequence_type_identifier() -{ + ReturnCode_t return_code_float_bounded_sequence {eprosima::fastdds::dds::RETCODE_OK}; + return_code_float_bounded_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "float_bounded_sequence", type_ids_float_bounded_sequence); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_float_bounded_sequence) { StructTypeFlag struct_flags_float_bounded_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_float_bounded_sequence; - TypeIdentifierPair type_ids_float_bounded_sequence; QualifiedTypeName type_name_float_bounded_sequence = "float_bounded_sequence"; eprosima::fastcdr::optional type_ann_builtin_float_bounded_sequence; eprosima::fastcdr::optional ann_custom_float_bounded_sequence; @@ -63,151 +59,58 @@ void register_float_bounded_sequence_type_identifier() header_float_bounded_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_float_bounded_sequence); CompleteStructMemberSeq member_seq_float_bounded_sequence; { - return_code_float_bounded_sequence = + TypeIdentifierPair type_ids_numbers; + ReturnCode_t return_code_numbers {eprosima::fastdds::dds::RETCODE_OK}; + return_code_numbers = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_float_13", type_ids_float_bounded_sequence); + "anonymous_sequence_float_13", type_ids_numbers); - if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_numbers) { - return_code_float_bounded_sequence = + return_code_numbers = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_float", type_ids_float_bounded_sequence); + "_float", type_ids_numbers); - if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_numbers) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); return; } - TypeIdentifier* element_identifier_anonymous_sequence_float_13 {nullptr}; - if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1()._d() || TK_NONE == type_ids_float_bounded_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_float_13 = new TypeIdentifier(type_ids_float_bounded_sequence.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_sequence_float_13 = new TypeIdentifier(type_ids_float_bounded_sequence.type_identifier2()); - } - else + bool element_identifier_anonymous_sequence_float_13_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_float_13 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_numbers, element_identifier_anonymous_sequence_float_13_ec))}; + if (!element_identifier_anonymous_sequence_float_13_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_sequence_float_13 = EK_COMPLETE; - if (TK_NONE == type_ids_float_bounded_sequence.type_identifier2()._d()) + if (TK_NONE == type_ids_numbers.type_identifier2()._d()) { equiv_kind_anonymous_sequence_float_13 = EK_BOTH; } CollectionElementFlag element_flags_anonymous_sequence_float_13 = 0; PlainCollectionHeader header_anonymous_sequence_float_13 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_float_13, element_flags_anonymous_sequence_float_13); - std::string type_id_kind_anonymous_sequence_float_13("TI_PLAIN_SEQUENCE_SMALL"); - if (type_id_kind_anonymous_sequence_float_13 == "TI_PLAIN_SEQUENCE_SMALL") { SBound bound = static_cast(13); PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_float_13, bound, eprosima::fastcdr::external(element_identifier_anonymous_sequence_float_13)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_float_13")) + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_float_13", type_ids_numbers)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_sequence_float_13 already registered in TypeObjectRegistry for a different type."); } } - else - { - LBound bound = 13; - PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_float_13, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_float_13)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_sequence_type_identifier(seq_ldefn, "anonymous_sequence_float_13")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_float_13 already registered in TypeObjectRegistry for a different type."); - } - } - return_code_float_bounded_sequence = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_float_13", type_ids_float_bounded_sequence); - if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_float_13: Given Sequence TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_numbers = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_numbers; MemberId member_id_numbers = 0x00000000; - if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1()._d() || TK_NONE == type_ids_float_bounded_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier1()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_numbers_ec {false}; + CommonStructMember common_numbers {TypeObjectUtils::build_common_struct_member(member_id_numbers, member_flags_numbers, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_numbers, common_numbers_ec))}; + if (!common_numbers_ec) { - common_numbers = TypeObjectUtils::build_common_struct_member(member_id_numbers, member_flags_numbers, type_ids_float_bounded_sequence.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_float_bounded_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_float_bounded_sequence.type_identifier2()._d() && - (EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_float_bounded_sequence.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_numbers = TypeObjectUtils::build_common_struct_member(member_id_numbers, member_flags_numbers, type_ids_float_bounded_sequence.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure numbers member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure numbers member TypeIdentifier inconsistent."); return; } MemberName name_numbers = "numbers"; @@ -219,20 +122,11 @@ void register_float_bounded_sequence_type_identifier() } CompleteStructType struct_type_float_bounded_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_float_bounded_sequence, header_float_bounded_sequence, member_seq_float_bounded_sequence); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_float_bounded_sequence, type_name_float_bounded_sequence.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_float_bounded_sequence, type_name_float_bounded_sequence.to_string(), type_ids_float_bounded_sequence)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "float_bounded_sequence already registered in TypeObjectRegistry for a different type."); } - return_code_float_bounded_sequence = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "float_bounded_sequence", type_ids_float_bounded_sequence); - if (return_code_float_bounded_sequence != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "float_bounded_sequence: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp index 8db0697d..bdf59876 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_float_bounded_sequence_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,8 +42,13 @@ eProsima_user_DllExport void register_float_bounded_sequence_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_float_bounded_sequence_type_identifier(); +eProsima_user_DllExport void register_float_bounded_sequence_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx index 96b24dc4..92cef86b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx @@ -219,9 +219,9 @@ bool hello_worldPubSubType::getKey( return true; } -void hello_worldPubSubType::register_type_object_representation() const +void hello_worldPubSubType::register_type_object_representation() { - register_hello_world_type_objects(); + register_hello_world_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h index a32015e0..dc1b82f2 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h @@ -89,7 +89,7 @@ class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx index 25cc8af3..5933c4db 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx @@ -38,23 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_hello_world_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_hello_world_type_identifier( + TypeIdentifierPair& type_ids_hello_world) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_hello_world_type_identifier(); - - }); -} -void register_hello_world_type_identifier() -{ + ReturnCode_t return_code_hello_world {eprosima::fastdds::dds::RETCODE_OK}; + return_code_hello_world = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "hello_world", type_ids_hello_world); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_hello_world) { StructTypeFlag struct_flags_hello_world = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_hello_world; - TypeIdentifierPair type_ids_hello_world; QualifiedTypeName type_name_hello_world = "hello_world"; eprosima::fastcdr::optional type_ann_builtin_hello_world; eprosima::fastcdr::optional ann_custom_hello_world; @@ -63,11 +59,13 @@ void register_hello_world_type_identifier() header_hello_world = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_hello_world); CompleteStructMemberSeq member_seq_hello_world; { - return_code_hello_world = + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_hello_world); + "_uint32_t", type_ids_index); - if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -75,48 +73,12 @@ void register_hello_world_type_identifier() } StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_index; MemberId member_id_index = 0x00000000; - if (EK_COMPLETE == type_ids_hello_world.type_identifier1()._d() || TK_NONE == type_ids_hello_world.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier1()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier1()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_hello_world.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_hello_world.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier2()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier2()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_hello_world.type_identifier2()); - } - else + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure index member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); return; } MemberName name_index = "index"; @@ -127,97 +89,34 @@ void register_hello_world_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_hello_world, member_index); } { - return_code_hello_world = + TypeIdentifierPair type_ids_message; + ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK}; + return_code_message = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_hello_world); + "anonymous_string_unbounded", type_ids_message); - if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_message)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_hello_world = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_hello_world); - if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_message; MemberId member_id_message = 0x00000001; - if (EK_COMPLETE == type_ids_hello_world.type_identifier1()._d() || TK_NONE == type_ids_hello_world.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier1()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier1()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier1()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_hello_world.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_hello_world.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_hello_world.type_identifier2()._d() && - EK_COMPLETE == type_ids_hello_world.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_hello_world.type_identifier2()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_hello_world.type_identifier2()._d() && - (EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_hello_world.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_message = TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, type_ids_hello_world.type_identifier2()); - } - else + bool common_message_ec {false}; + CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))}; + if (!common_message_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure message member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent."); return; } MemberName name_message = "message"; @@ -229,20 +128,11 @@ void register_hello_world_type_identifier() } CompleteStructType struct_type_hello_world = TypeObjectUtils::build_complete_struct_type(struct_flags_hello_world, header_hello_world, member_seq_hello_world); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_hello_world, type_name_hello_world.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_hello_world, type_name_hello_world.to_string(), type_ids_hello_world)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "hello_world already registered in TypeObjectRegistry for a different type."); } - return_code_hello_world = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "hello_world", type_ids_hello_world); - if (return_code_hello_world != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "hello_world: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp index 9c2829f4..dcf5d1a6 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_hello_world_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,8 +42,13 @@ eProsima_user_DllExport void register_hello_world_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_hello_world_type_identifier(); +eProsima_user_DllExport void register_hello_world_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx index 539bfbe0..ba09f468 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx @@ -219,9 +219,9 @@ bool map_structPubSubType::getKey( return true; } -void map_structPubSubType::register_type_object_representation() const +void map_structPubSubType::register_type_object_representation() { - register_map_struct_type_objects(); + register_map_struct_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h index 22f7d998..ba83e337 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h @@ -89,7 +89,7 @@ class map_structPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx index 3184897e..0d23ae09 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx @@ -38,23 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_map_struct_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_map_struct_type_identifier( + TypeIdentifierPair& type_ids_map_struct) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_map_struct_type_identifier(); - - }); -} -void register_map_struct_type_identifier() -{ + ReturnCode_t return_code_map_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_map_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "map_struct", type_ids_map_struct); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_map_struct) { StructTypeFlag struct_flags_map_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_map_struct; - TypeIdentifierPair type_ids_map_struct; QualifiedTypeName type_name_map_struct = "map_struct"; eprosima::fastcdr::optional type_ann_builtin_map_struct; eprosima::fastcdr::optional ann_custom_map_struct; @@ -63,150 +59,53 @@ void register_map_struct_type_identifier() header_map_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_map_struct); CompleteStructMemberSeq member_seq_map_struct; { - return_code_map_struct = + TypeIdentifierPair type_ids_my_map; + ReturnCode_t return_code_my_map {eprosima::fastdds::dds::RETCODE_OK}; + return_code_my_map = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_map_struct); + "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_my_map); - if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_my_map) { - return_code_map_struct = + return_code_my_map = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_map_struct); + "_bool", type_ids_my_map); - if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_my_map) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Map element TypeIdentifier unknown to TypeObjectRegistry."); return; } - TypeIdentifier* element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_map_struct.type_identifier1()._d() || TK_NONE == type_ids_map_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_map_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier2()); - } - else + bool element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_my_map, element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec))}; + if (!element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_map_anonymous_string_unbounded_bool_unbounded inconsistent element TypeIdentifier."); return; } - return_code_map_struct = + return_code_my_map = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_map_struct); + "anonymous_string_unbounded", type_ids_my_map); - if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_my_map) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_my_map)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_map_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_map_struct); - if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - TypeIdentifier* key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {nullptr}; - if (EK_COMPLETE == type_ids_map_struct.type_identifier1()._d() || TK_NONE == type_ids_map_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier1()); } - else if (EK_COMPLETE == type_ids_map_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded = new TypeIdentifier(type_ids_map_struct.type_identifier2()); - } - else + bool key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec {false}; + TypeIdentifier* key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_my_map, key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec))}; + if (!key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_map_anonymous_string_unbounded_bool_unbounded inconsistent key TypeIdentifier."); @@ -226,87 +125,27 @@ void register_map_struct_type_identifier() CollectionElementFlag element_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded = 0; CollectionElementFlag key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded = 0; PlainCollectionHeader header_anonymous_map_anonymous_string_unbounded_bool_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded, element_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded); - std::string type_id_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded("TI_PLAIN_MAP_SMALL"); - if (type_id_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded == "TI_PLAIN_MAP_SMALL") { SBound bound = 0; PlainMapSTypeDefn map_sdefn = TypeObjectUtils::build_plain_map_s_type_defn(header_anonymous_map_anonymous_string_unbounded_bool_unbounded, bound, eprosima::fastcdr::external(element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded), key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded, eprosima::fastcdr::external(key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_map_type_identifier(map_sdefn, "anonymous_map_anonymous_string_unbounded_bool_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_map_anonymous_string_unbounded_bool_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBound bound = 0; - PlainMapLTypeDefn map_ldefn = TypeObjectUtils::build_plain_map_l_type_defn(header_anonymous_map_anonymous_string_unbounded_bool_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded), key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded, - eprosima::fastcdr::external(key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_map_type_identifier(map_ldefn, "anonymous_map_anonymous_string_unbounded_bool_unbounded")) + TypeObjectUtils::build_and_register_s_map_type_identifier(map_sdefn, "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_my_map)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_map_anonymous_string_unbounded_bool_unbounded already registered in TypeObjectRegistry for a different type."); } } - return_code_map_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_map_struct); - if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_map_anonymous_string_unbounded_bool_unbounded: Given Map TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_my_map = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_my_map; MemberId member_id_my_map = 0x00000000; - if (EK_COMPLETE == type_ids_map_struct.type_identifier1()._d() || TK_NONE == type_ids_map_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_my_map = TypeObjectUtils::build_common_struct_member(member_id_my_map, member_flags_my_map, type_ids_map_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_map_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_map_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_map_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_map_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_map_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_map_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_my_map_ec {false}; + CommonStructMember common_my_map {TypeObjectUtils::build_common_struct_member(member_id_my_map, member_flags_my_map, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_my_map, common_my_map_ec))}; + if (!common_my_map_ec) { - common_my_map = TypeObjectUtils::build_common_struct_member(member_id_my_map, member_flags_my_map, type_ids_map_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure my_map member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure my_map member TypeIdentifier inconsistent."); return; } MemberName name_my_map = "my_map"; @@ -318,20 +157,11 @@ void register_map_struct_type_identifier() } CompleteStructType struct_type_map_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_map_struct, header_map_struct, member_seq_map_struct); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_map_struct, type_name_map_struct.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_map_struct, type_name_map_struct.to_string(), type_ids_map_struct)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "map_struct already registered in TypeObjectRegistry for a different type."); } - return_code_map_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "map_struct", type_ids_map_struct); - if (return_code_map_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "map_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp index 98d413c6..c0af3f4f 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_map_struct_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,8 +42,13 @@ eProsima_user_DllExport void register_map_struct_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_map_struct_type_identifier(); +eProsima_user_DllExport void register_map_struct_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx index 0db9f668..db386977 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx @@ -219,9 +219,9 @@ bool numeric_arrayPubSubType::getKey( return true; } -void numeric_arrayPubSubType::register_type_object_representation() const +void numeric_arrayPubSubType::register_type_object_representation() { - register_numeric_array_type_objects(); + register_numeric_array_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h index f8d59b12..e6a48732 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h @@ -89,7 +89,7 @@ class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx index 70c96e42..8f4b9e2f 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx @@ -38,23 +38,19 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_numeric_array_type_objects() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_numeric_array_type_identifier( + TypeIdentifierPair& type_ids_numeric_array) { - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_numeric_array_type_identifier(); - - }); -} -void register_numeric_array_type_identifier() -{ + ReturnCode_t return_code_numeric_array {eprosima::fastdds::dds::RETCODE_OK}; + return_code_numeric_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "numeric_array", type_ids_numeric_array); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_numeric_array) { StructTypeFlag struct_flags_numeric_array = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_numeric_array; - TypeIdentifierPair type_ids_numeric_array; QualifiedTypeName type_name_numeric_array = "numeric_array"; eprosima::fastcdr::optional type_ann_builtin_numeric_array; eprosima::fastcdr::optional ann_custom_numeric_array; @@ -63,74 +59,38 @@ void register_numeric_array_type_identifier() header_numeric_array = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_numeric_array); CompleteStructMemberSeq member_seq_numeric_array; { - return_code_numeric_array = + TypeIdentifierPair type_ids_points; + ReturnCode_t return_code_points {eprosima::fastdds::dds::RETCODE_OK}; + return_code_points = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_int32_t_3", type_ids_numeric_array); + "anonymous_array_int32_t_3", type_ids_points); - if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_points) { - return_code_numeric_array = + return_code_points = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_numeric_array); + "_int32_t", type_ids_points); - if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_points) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier unknown to TypeObjectRegistry."); return; } - TypeIdentifier* element_identifier_anonymous_array_int32_t_3 {nullptr}; - if (EK_COMPLETE == type_ids_numeric_array.type_identifier1()._d() || TK_NONE == type_ids_numeric_array.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier1()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier1()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_array_int32_t_3 = new TypeIdentifier(type_ids_numeric_array.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_numeric_array.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier2()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier2()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - element_identifier_anonymous_array_int32_t_3 = new TypeIdentifier(type_ids_numeric_array.type_identifier2()); - } - else + bool element_identifier_anonymous_array_int32_t_3_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_int32_t_3 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_points, element_identifier_anonymous_array_int32_t_3_ec))}; + if (!element_identifier_anonymous_array_int32_t_3_ec) { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Array element TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); return; } EquivalenceKind equiv_kind_anonymous_array_int32_t_3 = EK_COMPLETE; - if (TK_NONE == type_ids_numeric_array.type_identifier2()._d()) + if (TK_NONE == type_ids_points.type_identifier2()._d()) { equiv_kind_anonymous_array_int32_t_3 = EK_BOTH; } CollectionElementFlag element_flags_anonymous_array_int32_t_3 = 0; PlainCollectionHeader header_anonymous_array_int32_t_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_int32_t_3, element_flags_anonymous_array_int32_t_3); - std::string type_id_kind_anonymous_array_int32_t_3("TI_PLAIN_ARRAY_SMALL"); - if (type_id_kind_anonymous_array_int32_t_3 == "TI_PLAIN_ARRAY_SMALL") { SBoundSeq array_bound_seq; TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); @@ -138,80 +98,21 @@ void register_numeric_array_type_identifier() PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_int32_t_3, array_bound_seq, eprosima::fastcdr::external(element_identifier_anonymous_array_int32_t_3)); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_int32_t_3")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_int32_t_3 already registered in TypeObjectRegistry for a different type."); - } - } - else - { - LBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); - - PlainArrayLElemDefn array_ldefn = TypeObjectUtils::build_plain_array_l_elem_defn(header_anonymous_array_int32_t_3, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_int32_t_3)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_array_type_identifier(array_ldefn, "anonymous_array_int32_t_3")) + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_int32_t_3", type_ids_points)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_array_int32_t_3 already registered in TypeObjectRegistry for a different type."); } } - return_code_numeric_array = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_int32_t_3", type_ids_numeric_array); - if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_int32_t_3: Given Array TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } StructMemberFlag member_flags_points = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_points; MemberId member_id_points = 0x00000000; - if (EK_COMPLETE == type_ids_numeric_array.type_identifier1()._d() || TK_NONE == type_ids_numeric_array.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier1()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier1()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier1()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_points_ec {false}; + CommonStructMember common_points {TypeObjectUtils::build_common_struct_member(member_id_points, member_flags_points, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_points, common_points_ec))}; + if (!common_points_ec) { - common_points = TypeObjectUtils::build_common_struct_member(member_id_points, member_flags_points, type_ids_numeric_array.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_numeric_array.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_numeric_array.type_identifier2()._d() && - EK_COMPLETE == type_ids_numeric_array.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_numeric_array.type_identifier2()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_numeric_array.type_identifier2()._d() && - (EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_numeric_array.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_points = TypeObjectUtils::build_common_struct_member(member_id_points, member_flags_points, type_ids_numeric_array.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure points member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure points member TypeIdentifier inconsistent."); return; } MemberName name_points = "points"; @@ -223,20 +124,11 @@ void register_numeric_array_type_identifier() } CompleteStructType struct_type_numeric_array = TypeObjectUtils::build_complete_struct_type(struct_flags_numeric_array, header_numeric_array, member_seq_numeric_array); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_numeric_array, type_name_numeric_array.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_numeric_array, type_name_numeric_array.to_string(), type_ids_numeric_array)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "numeric_array already registered in TypeObjectRegistry for a different type."); } - return_code_numeric_array = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "numeric_array", type_ids_numeric_array); - if (return_code_numeric_array != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "numeric_array: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp index 5801dc0e..05a27bf5 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_numeric_array_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,8 +42,13 @@ eProsima_user_DllExport void register_numeric_array_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_numeric_array_type_identifier(); +eProsima_user_DllExport void register_numeric_array_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx index 00740e35..b480b644 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx @@ -219,9 +219,9 @@ bool union_structPubSubType::getKey( return true; } -void union_structPubSubType::register_type_object_representation() const +void union_structPubSubType::register_type_object_representation() { - register_union_struct_type_objects(); + register_union_struct_type_identifier(type_identifiers_); } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h index 4771c51d..0b3e94a5 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h @@ -89,7 +89,7 @@ class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() const override; + eProsima_user_DllExport void register_type_object_representation() override; #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx index ee022630..3f613bd2 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx @@ -38,23 +38,16 @@ using namespace eprosima::fastdds::dds::xtypes; -void register_union_struct_type_objects() -{ - static std::once_flag once_flag; - std::call_once(once_flag, []() - { - register_MyUnion_type_identifier(); - - register_union_struct_type_identifier(); - - }); -} - -void register_MyUnion_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_MyUnion_type_identifier( + TypeIdentifierPair& type_ids_MyUnion) { + ReturnCode_t return_code_MyUnion {eprosima::fastdds::dds::RETCODE_OK}; + return_code_MyUnion = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "MyUnion", type_ids_MyUnion); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) { - ReturnCode_t return_code_MyUnion; - TypeIdentifierPair type_ids_MyUnion; UnionTypeFlag union_flags_MyUnion = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); QualifiedTypeName type_name_MyUnion = "MyUnion"; @@ -99,7 +92,7 @@ void register_MyUnion_type_identifier() eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( "_byte", type_ids_MyUnion); - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "octet_value Union member TypeIdentifier unknown to TypeObjectRegistry."); @@ -109,50 +102,14 @@ void register_MyUnion_type_identifier() false, false); UnionCaseLabelSeq label_seq_octet_value; TypeObjectUtils::add_union_case_label(label_seq_octet_value, static_cast(1)); - CommonUnionMember common_octet_value; MemberId member_id_octet_value = 0x00000001; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_octet_value_ec {false}; + CommonUnionMember common_octet_value {TypeObjectUtils::build_common_union_member(member_id_octet_value, + member_flags_octet_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MyUnion, + common_octet_value_ec), label_seq_octet_value)}; + if (!common_octet_value_ec) { - common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier1(), - label_seq_octet_value); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier2(), - label_seq_octet_value); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union octet_value member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union octet_value member TypeIdentifier inconsistent."); return; } MemberName name_octet_value = "octet_value"; @@ -167,7 +124,7 @@ void register_MyUnion_type_identifier() eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( "_int32_t", type_ids_MyUnion); - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "long_value Union member TypeIdentifier unknown to TypeObjectRegistry."); @@ -177,50 +134,14 @@ void register_MyUnion_type_identifier() false, false); UnionCaseLabelSeq label_seq_long_value; TypeObjectUtils::add_union_case_label(label_seq_long_value, static_cast(2)); - CommonUnionMember common_long_value; MemberId member_id_long_value = 0x00000002; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_long_value_ec {false}; + CommonUnionMember common_long_value {TypeObjectUtils::build_common_union_member(member_id_long_value, + member_flags_long_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MyUnion, + common_long_value_ec), label_seq_long_value)}; + if (!common_long_value_ec) { - common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier1(), - label_seq_long_value); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier2(), - label_seq_long_value); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union long_value member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union long_value member TypeIdentifier inconsistent."); return; } MemberName name_long_value = "long_value"; @@ -235,97 +156,32 @@ void register_MyUnion_type_identifier() eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( "anonymous_string_unbounded", type_ids_MyUnion); - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") { SBound bound = 0; StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) + "anonymous_string_unbounded", type_ids_MyUnion)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); } } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_MyUnion); - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } UnionMemberFlag member_flags_string_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false); UnionCaseLabelSeq label_seq_string_value; TypeObjectUtils::add_union_case_label(label_seq_string_value, static_cast(3)); - CommonUnionMember common_string_value; MemberId member_id_string_value = 0x00000003; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_string_value_ec {false}; + CommonUnionMember common_string_value {TypeObjectUtils::build_common_union_member(member_id_string_value, + member_flags_string_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MyUnion, + common_string_value_ec), label_seq_string_value)}; + if (!common_string_value_ec) { - common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier1(), - label_seq_string_value); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier2(), - label_seq_string_value); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union string_value member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union string_value member TypeIdentifier inconsistent."); return; } MemberName name_string_value = "string_value"; @@ -338,29 +194,26 @@ void register_MyUnion_type_identifier() CompleteUnionType union_type_MyUnion = TypeObjectUtils::build_complete_union_type(union_flags_MyUnion, header_MyUnion, discriminator_MyUnion, member_seq_MyUnion); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_union_type_object(union_type_MyUnion, type_name_MyUnion.to_string())) + TypeObjectUtils::build_and_register_union_type_object(union_type_MyUnion, type_name_MyUnion.to_string(), type_ids_MyUnion)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "MyUnion already registered in TypeObjectRegistry for a different type."); } - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MyUnion", type_ids_MyUnion); - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MyUnion: Given Union TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } -void register_union_struct_type_identifier() +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_union_struct_type_identifier( + TypeIdentifierPair& type_ids_union_struct) { + + ReturnCode_t return_code_union_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_union_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "union_struct", type_ids_union_struct); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_union_struct) { StructTypeFlag struct_flags_union_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, false, false); - ReturnCode_t return_code_union_struct; - TypeIdentifierPair type_ids_union_struct; QualifiedTypeName type_name_union_struct = "union_struct"; eprosima::fastcdr::optional type_ann_builtin_union_struct; eprosima::fastcdr::optional ann_custom_union_struct; @@ -369,11 +222,13 @@ void register_union_struct_type_identifier() header_union_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_union_struct); CompleteStructMemberSeq member_seq_union_struct; { - return_code_union_struct = + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_union_struct); + "_uint32_t", type_ids_index); - if (return_code_union_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); @@ -381,48 +236,12 @@ void register_union_struct_type_identifier() } StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_index; MemberId member_id_index = 0x00000000; - if (EK_COMPLETE == type_ids_union_struct.type_identifier1()._d() || TK_NONE == type_ids_union_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_union_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_union_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) { - common_index = TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, type_ids_union_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure index member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); return; } MemberName name_index = "index"; @@ -433,358 +252,24 @@ void register_union_struct_type_identifier() TypeObjectUtils::add_complete_struct_member(member_seq_union_struct, member_index); } { - return_code_union_struct = + TypeIdentifierPair type_ids_union_value; + ReturnCode_t return_code_union_value {eprosima::fastdds::dds::RETCODE_OK}; + return_code_union_value = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MyUnion", type_ids_union_struct); + "MyUnion", type_ids_union_value); - if (return_code_union_struct != eprosima::fastdds::dds::RETCODE_OK) + if (eprosima::fastdds::dds::RETCODE_OK != return_code_union_value) { - { - ReturnCode_t return_code_MyUnion; - TypeIdentifierPair type_ids_MyUnion; - UnionTypeFlag union_flags_MyUnion = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, - false, false); - QualifiedTypeName type_name_MyUnion = "MyUnion"; - eprosima::fastcdr::optional type_ann_builtin_MyUnion; - eprosima::fastcdr::optional ann_custom_MyUnion; - CompleteTypeDetail detail_MyUnion = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MyUnion, ann_custom_MyUnion, type_name_MyUnion.to_string()); - CompleteUnionHeader header_MyUnion = TypeObjectUtils::build_complete_union_header(detail_MyUnion); - UnionDiscriminatorFlag member_flags_MyUnion = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false); - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_MyUnion); - - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union discriminator TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - CommonDiscriminatorMember common_MyUnion; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d()) - { - common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d()) - { - common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MyUnion discriminator TypeIdentifier inconsistent."); - return; - } - type_ann_builtin_MyUnion.reset(); - ann_custom_MyUnion.reset(); - CompleteDiscriminatorMember discriminator_MyUnion = TypeObjectUtils::build_complete_discriminator_member(common_MyUnion, - type_ann_builtin_MyUnion, ann_custom_MyUnion); - CompleteUnionMemberSeq member_seq_MyUnion; - { - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_byte", type_ids_MyUnion); - - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "octet_value Union member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - UnionMemberFlag member_flags_octet_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false); - UnionCaseLabelSeq label_seq_octet_value; - TypeObjectUtils::add_union_case_label(label_seq_octet_value, static_cast(1)); - CommonUnionMember common_octet_value; - MemberId member_id_octet_value = 0x00000001; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier1(), - label_seq_octet_value); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_octet_value = TypeObjectUtils::build_common_union_member(member_id_octet_value, member_flags_octet_value, type_ids_MyUnion.type_identifier2(), - label_seq_octet_value); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union octet_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_octet_value = "octet_value"; - eprosima::fastcdr::optional member_ann_builtin_octet_value; - ann_custom_MyUnion.reset(); - CompleteMemberDetail detail_octet_value = TypeObjectUtils::build_complete_member_detail(name_octet_value, member_ann_builtin_octet_value, ann_custom_MyUnion); - CompleteUnionMember member_octet_value = TypeObjectUtils::build_complete_union_member(common_octet_value, detail_octet_value); - TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_octet_value); - } - { - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_MyUnion); - - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "long_value Union member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - UnionMemberFlag member_flags_long_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false); - UnionCaseLabelSeq label_seq_long_value; - TypeObjectUtils::add_union_case_label(label_seq_long_value, static_cast(2)); - CommonUnionMember common_long_value; - MemberId member_id_long_value = 0x00000002; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier1(), - label_seq_long_value); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_long_value = TypeObjectUtils::build_common_union_member(member_id_long_value, member_flags_long_value, type_ids_MyUnion.type_identifier2(), - label_seq_long_value); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union long_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_long_value = "long_value"; - eprosima::fastcdr::optional member_ann_builtin_long_value; - ann_custom_MyUnion.reset(); - CompleteMemberDetail detail_long_value = TypeObjectUtils::build_complete_member_detail(name_long_value, member_ann_builtin_long_value, ann_custom_MyUnion); - CompleteUnionMember member_long_value = TypeObjectUtils::build_complete_union_member(common_long_value, detail_long_value); - TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_long_value); - } - { - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_MyUnion); - - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - std::string type_id_kind_anonymous_string_unbounded("TI_STRING8_SMALL"); - if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_SMALL") - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else if (type_id_kind_anonymous_string_unbounded == "TI_STRING8_LARGE") - { - LBound bound = 255; - StringLTypeDefn string_ldefn = TypeObjectUtils::build_string_l_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_l_string_type_identifier(string_ldefn, - "anonymous_string_unbounded")) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Unknown String kind."); - return; - } - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_MyUnion); - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded: Given String TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } - UnionMemberFlag member_flags_string_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, - false, false); - UnionCaseLabelSeq label_seq_string_value; - TypeObjectUtils::add_union_case_label(label_seq_string_value, static_cast(3)); - CommonUnionMember common_string_value; - MemberId member_id_string_value = 0x00000003; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier1()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier1()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier1().map_ldefn().key_identifier()->_d()))) - { - common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier1(), - label_seq_string_value); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_MyUnion.type_identifier2()._d() && - EK_COMPLETE == type_ids_MyUnion.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_MyUnion.type_identifier2()._d() && - (EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_MyUnion.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_string_value = TypeObjectUtils::build_common_union_member(member_id_string_value, member_flags_string_value, type_ids_MyUnion.type_identifier2(), - label_seq_string_value); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union string_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_string_value = "string_value"; - eprosima::fastcdr::optional member_ann_builtin_string_value; - ann_custom_MyUnion.reset(); - CompleteMemberDetail detail_string_value = TypeObjectUtils::build_complete_member_detail(name_string_value, member_ann_builtin_string_value, ann_custom_MyUnion); - CompleteUnionMember member_string_value = TypeObjectUtils::build_complete_union_member(common_string_value, detail_string_value); - TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_string_value); - } - CompleteUnionType union_type_MyUnion = TypeObjectUtils::build_complete_union_type(union_flags_MyUnion, header_MyUnion, discriminator_MyUnion, - member_seq_MyUnion); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_union_type_object(union_type_MyUnion, type_name_MyUnion.to_string())) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MyUnion already registered in TypeObjectRegistry for a different type."); - } - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MyUnion", type_ids_MyUnion); - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MyUnion: Given Union TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - } + ::register_MyUnion_type_identifier(type_ids_union_value); } StructMemberFlag member_flags_union_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, false, false, false, false); - CommonStructMember common_union_value; MemberId member_id_union_value = 0x00000001; - if (EK_COMPLETE == type_ids_union_struct.type_identifier1()._d() || TK_NONE == type_ids_union_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier1()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier1().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier1().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier1()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier1().map_ldefn().key_identifier()->_d()))) + bool common_union_value_ec {false}; + CommonStructMember common_union_value {TypeObjectUtils::build_common_struct_member(member_id_union_value, member_flags_union_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_union_value, common_union_value_ec))}; + if (!common_union_value_ec) { - common_union_value = TypeObjectUtils::build_common_struct_member(member_id_union_value, member_flags_union_value, type_ids_union_struct.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_union_struct.type_identifier2()._d() || - (TI_PLAIN_SEQUENCE_SMALL == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == type_ids_union_struct.type_identifier2()._d() && - EK_COMPLETE == type_ids_union_struct.type_identifier2().array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == type_ids_union_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier2().map_sdefn().key_identifier()->_d())) || - (TI_PLAIN_MAP_LARGE == type_ids_union_struct.type_identifier2()._d() && - (EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().header().equiv_kind() || - EK_COMPLETE == type_ids_union_struct.type_identifier2().map_ldefn().key_identifier()->_d()))) - { - common_union_value = TypeObjectUtils::build_common_struct_member(member_id_union_value, member_flags_union_value, type_ids_union_struct.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Structure union_value member TypeIdentifier inconsistent."); + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure union_value member TypeIdentifier inconsistent."); return; } MemberName name_union_value = "union_value"; @@ -796,20 +281,11 @@ void register_union_struct_type_identifier() } CompleteStructType struct_type_union_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_union_struct, header_union_struct, member_seq_union_struct); if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_union_struct, type_name_union_struct.to_string())) + TypeObjectUtils::build_and_register_struct_type_object(struct_type_union_struct, type_name_union_struct.to_string(), type_ids_union_struct)) { EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "union_struct already registered in TypeObjectRegistry for a different type."); } - return_code_union_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "union_struct", type_ids_union_struct); - if (return_code_union_struct != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "union_struct: Given Struct TypeIdentifier unknown to TypeObjectRegistry."); - return; - } } } diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp index 7db11667..6e1e1dbf 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp @@ -22,6 +22,8 @@ #ifndef _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ #define _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#include + #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -33,11 +35,6 @@ #define eProsima_user_DllExport #endif // _WIN32 -/** - * @brief Register every TypeObject representation defined in the IDL file in Fast DDS TypeObjectRegistry. - */ -eProsima_user_DllExport void register_union_struct_type_objects(); - #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC /** @@ -45,15 +42,25 @@ eProsima_user_DllExport void register_union_struct_type_objects(); * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_MyUnion_type_identifier(); +eProsima_user_DllExport void register_MyUnion_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); /** * @brief Register union_struct related TypeIdentifier. * Fully-descriptive TypeIdentifiers are directly registered. * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. */ -eProsima_user_DllExport void register_union_struct_type_identifier(); +eProsima_user_DllExport void register_union_struct_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index c3f90745..f19a8ad2 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -73,13 +73,13 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain ///////////////////////// DDSPIPE_PARTICIPANTS_DllAPI - virtual core::types::ParticipantId id() const noexcept override; + core::types::ParticipantId id() const noexcept override; DDSPIPE_PARTICIPANTS_DllAPI - virtual bool is_rtps_kind() const noexcept override; + bool is_rtps_kind() const noexcept override; DDSPIPE_PARTICIPANTS_DllAPI - virtual bool is_repeater() const noexcept override; + bool is_repeater() const noexcept override; DDSPIPE_PARTICIPANTS_DllAPI core::types::TopicQoS topic_qos() const noexcept override; @@ -106,17 +106,17 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain // LISTENER METHODS ///////////////////////// - virtual void on_participant_discovery( + void on_participant_discovery( fastdds::dds::DomainParticipant* participant, fastrtps::rtps::ParticipantDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; - virtual void on_data_reader_discovery( + void on_data_reader_discovery( fastdds::dds::DomainParticipant* participant, fastrtps::rtps::ReaderDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; - virtual void on_data_writer_discovery( + void on_data_writer_discovery( fastdds::dds::DomainParticipant* participant, fastrtps::rtps::WriterDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 4ce75f4e..3a39a418 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -18,11 +18,16 @@ #pragma once -#include -#include -#include +#include + +#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -34,8 +39,7 @@ namespace ddspipe { namespace participants { /** - * This is an abomination Participant that is a Simple RTPS Participant with a built-in DDS Participant. - * The DDS Part that is only used to read type objects and type lookup services. + * Simple RTPS Participant * * TODO: separate these 2 participants */ @@ -86,15 +90,10 @@ class DynTypesParticipant : public rtps::SimpleParticipant protected: - void on_type_discovery_( - fastrtps::rtps::RTPSParticipant* participant, + void notify_type_discovered_( const fastdds::dds::xtypes::TypeInformation& type_info, const fastcdr::string_255& type_name); - void internal_notify_type_object_( - fastdds::dds::DynamicType::_ref_type dynamic_type, - const std::tuple& type_name_and_id); - //! Type Object Internal Reader std::shared_ptr type_object_reader_; }; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp index cb9ddfd4..36cccdce 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp @@ -18,11 +18,10 @@ #pragma once -#include - -#include +#include #include +#include #include #include @@ -40,7 +39,8 @@ class ISchemaHandler virtual void add_schema( const fastdds::dds::DynamicType::_ref_type& dynamic_type, - const std::tuple& type_ids_tuple) = 0; + const std::string& type_name, + const fastdds::dds::xtypes::TypeIdentifier& type_id) = 0; virtual void add_data( const core::types::DdsTopic& topic, diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp index 553112fe..0225a8f1 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp @@ -14,9 +14,14 @@ #pragma once -#include +#include +#include + #include #include +#include +#include +#include #include #include @@ -38,10 +43,10 @@ class TopicDataType : public eprosima::fastdds::dds::TopicDataType //! Default constructor DDSPIPE_PARTICIPANTS_DllAPI TopicDataType( - const std::string& type_name, - const bool keyed, const std::shared_ptr& payload_pool, - const fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + const std::string& type_name, + const fastdds::dds::xtypes::TypeIdentifierPair& type_ids, + const bool keyed); //! Default destructor DDSPIPE_PARTICIPANTS_DllAPI diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index fbdc1f62..b6029d34 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -14,19 +14,28 @@ #pragma once +#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 diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp index 7befb817..fba496f0 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp @@ -14,6 +14,15 @@ #pragma once +#include + +#include +#include + +#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index e941ca29..0534890b 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -407,10 +407,10 @@ fastdds::dds::Topic* CommonParticipant::topic_related_( dds_participant_->register_type( eprosima::fastdds::dds::TypeSupport( new TopicDataType( - topic.type_name, - topic.topic_qos.keyed, payload_pool_, - topic.type_ids)) + topic.type_name, + topic.type_ids, + topic.topic_qos.keyed)) ); } diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index c5547c1c..851ed9a9 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -15,10 +15,8 @@ #include #include -#include #include -// #include -// #include +#include #include #include @@ -41,15 +39,13 @@ XmlParticipant::XmlParticipant( : CommonParticipant(participant_configuration, payload_pool, discovery_database) , xml_specific_configuration_(*reinterpret_cast(configuration_.get())) { - if (xml_specific_configuration_.participant_profile.is_set()) - { - fastdds::dds::DomainParticipantExtendedQos extended_qos; - if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( + fastdds::dds::DomainParticipantExtendedQos extended_qos; + if (xml_specific_configuration_.participant_profile.is_set() && + fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( xml_specific_configuration_.participant_profile.get_value(), extended_qos)) - { - configuration_->domain = extended_qos.domainId(); - } + { + configuration_->domain = extended_qos.domainId(); } } diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 1e4d3bcc..4783be75 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -18,25 +18,17 @@ #include -#include -#include - -#include - #include -#include -#include #include #include #include #include #include #include -#include -#include -#include #include +#include + #include #include #include @@ -103,11 +95,14 @@ void DynTypesParticipant::onReaderDiscovery( fastrtps::rtps::ReaderDiscoveryInfo&& info) { fastrtps::rtps::ReaderProxyData proxy_copy(info.info); + // Get type information const auto type_info = proxy_copy.type_information().type_information; const auto type_name = proxy_copy.typeName(); + rtps::CommonParticipant::onReaderDiscovery(participant, std::move(info)); - on_type_discovery_(participant, type_info, type_name); + + notify_type_discovered_(type_info, type_name); } void DynTypesParticipant::onWriterDiscovery( @@ -115,55 +110,53 @@ void DynTypesParticipant::onWriterDiscovery( fastrtps::rtps::WriterDiscoveryInfo&& info) { fastrtps::rtps::WriterProxyData proxy_copy(info.info); + // Get type information const auto type_info = proxy_copy.type_information().type_information; const auto type_name = proxy_copy.typeName(); + rtps::CommonParticipant::onWriterDiscovery(participant, std::move(info)); - on_type_discovery_(participant, type_info, type_name); + + notify_type_discovered_(type_info, type_name); } -void DynTypesParticipant::on_type_discovery_( - fastrtps::rtps::RTPSParticipant* participant, +void DynTypesParticipant::notify_type_discovered_( const fastdds::dds::xtypes::TypeInformation& type_info, const fastcdr::string_255& type_name) { - auto type_identifier = type_info.complete().typeid_with_size().type_id(); + const auto type_identifier = type_info.complete().typeid_with_size().type_id(); fastdds::dds::xtypes::TypeObject dyn_type_object; if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( type_identifier, dyn_type_object)) { + logWarning(DDSPIPE_DYNTYPES_PARTICIPANT, + "Failed to get type object of " << type_name << "type"); return; } - // TODO + // Create Dynamic Type fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( dyn_type_object)->build(); if (!dyn_type) { + logWarning(DDSPIPE_DYNTYPES_PARTICIPANT, + "Failed to create Dynamic Type " << type_name); return; } - else - { - // Save type_identifier and its associated tyme_name. NOTE: We assume each type_name corresponds to only one type_identifier - auto type_name_and_id = std::make_tuple(type_name, type_identifier); - internal_notify_type_object_(dyn_type, type_name_and_id); - } -} -void DynTypesParticipant::internal_notify_type_object_( - fastdds::dds::DynamicType::_ref_type dynamic_type, - const std::tuple& type_name_and_id) -{ + // Notify type_identifier and its associated tyme_name. + // NOTE: We assume each type_name corresponds to only one type_identifier logInfo(DDSPIPE_DYNTYPES_PARTICIPANT, - "Participant " << this->id() << " discovered type object " << dynamic_type->get_name()); + "Participant " << this->id() << " discovered type object " << dyn_type->get_name()); - monitor_type_discovered((dynamic_type->get_name()).to_string()); + monitor_type_discovered(type_name.to_string()); // Create data containing Dynamic Type auto data = std::make_unique(); - data->dynamic_type = dynamic_type; // TODO: add constructor with param - data->type_ids_tuple = type_name_and_id; + data->dynamic_type = dyn_type; // TODO: add constructor with param + data->type_name = type_name; + data->type_id = type_identifier; // Insert new data in internal reader queue type_object_reader_->simulate_data_reception(std::move(data)); diff --git a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp index b51cc17b..6ccd4f13 100644 --- a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp @@ -187,7 +187,6 @@ utils::ReturnCode CommonReader::take_nts_( if (ret != fastdds::dds::RETCODE_OK) { // There has been an error taking the data. Exit. - data.reset(rtps_data.release()); return ret; } } while (!should_accept_sample_(info)); diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index d81e965e..f44e103d 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -352,12 +352,12 @@ fastrtps::TopicAttributes CommonReader::reckon_topic_attributes_( att.historyQos.depth = topic.topic_qos.history_depth; // Set TypeInformation of the discovered type - fastdds::dds::xtypes::TypeInformation type_info; + fastdds::dds::xtypes::TypeInformation type_information; if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( topic.type_ids, - type_info)) + type_information)) { - att.type_information = type_info; + att.type_information = type_information; } return att; diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index 16fc101d..df97ad40 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -27,13 +27,13 @@ namespace dds { using eprosima::ddspipe::core::types::operator <<; TopicDataType::TopicDataType( - const std::string& type_name, - const bool keyed, const std::shared_ptr& payload_pool, - const fastdds::dds::xtypes::TypeIdentifierPair& type_ids) - : type_name_(type_name) + const std::string& type_name, + const fastdds::dds::xtypes::TypeIdentifierPair& type_ids, + const bool keyed) + : payload_pool_(payload_pool) + , type_name_(type_name) , keyed_(keyed) - , payload_pool_(payload_pool) { // Set topic data m_typeSize = 4; diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp index 0817fb9d..a76d1e48 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp @@ -73,24 +73,19 @@ utils::ReturnCode BaseWriter::write( { std::lock_guard lock(mutex_); - if (enabled_.load()) - { - if (!should_send_sample_()) - { - return utils::ReturnCode::OK; - } - else - { - return write_nts_(data); - } - - } - else + if (!enabled_.load()) { logDevError(DDSPIPE_BASEWRITER, "Attempt to write data from disabled Writer in topic in Participant " << participant_id_); return utils::ReturnCode::NOT_ENABLED; } + + if (!should_send_sample_()) + { + return utils::ReturnCode::OK; + } + + return write_nts_(data); } void BaseWriter::enable_() noexcept diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp index 30cc9a02..ab7e7486 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp @@ -51,7 +51,8 @@ utils::ReturnCode TypeObjectWriter::write_nts_( // Add schema try { - schema_handler_->add_schema(dynamic_type_data.dynamic_type, dynamic_type_data.type_ids_tuple); + schema_handler_->add_schema( + dynamic_type_data.dynamic_type, dynamic_type_data.type_name.to_string(), dynamic_type_data.type_id); } catch (const utils::Exception& e) { diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index c031b837..1bb2121b 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -12,11 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include - #include +#include +#include +#include #include #include @@ -24,10 +23,10 @@ #include #include +#include #include #include #include -#include namespace eprosima { namespace ddspipe { @@ -403,12 +402,12 @@ fastrtps::TopicAttributes CommonWriter::reckon_topic_attributes_( att.topicDataType = topic.type_name; // Set TypeInformation of the discovered type - fastdds::dds::xtypes::TypeInformation type_info; + fastdds::dds::xtypes::TypeInformation type_information; if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( topic.type_ids, - type_info)) + type_information)) { - att.type_information = type_info; + att.type_information = type_information; } return att; diff --git a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp index f2678b0a..e51b8453 100644 --- a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp +++ b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp @@ -38,7 +38,7 @@ utils::ReturnCode XmlHandler::load_xml( // Load string if exist if (configuration.raw.is_set()) { - fastdds::dds::ReturnCode_t ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_string( + ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_string( configuration.raw->c_str(), configuration.raw->size()); @@ -51,7 +51,7 @@ utils::ReturnCode XmlHandler::load_xml( // Load files for (const auto& file : configuration.files) { - fastdds::dds::ReturnCode_t ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_file(file); + ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_file(file); if (ret != fastdds::dds::RETCODE_OK) { diff --git a/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp b/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp index 79f65f6f..a7892574 100644 --- a/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp +++ b/ddspipe_participants/src/cpp/xml/XmlHandlerConfiguration.cpp @@ -15,8 +15,6 @@ #include #include -// #include - #include namespace eprosima { @@ -27,19 +25,6 @@ namespace participants { bool XmlHandlerConfiguration::is_valid( utils::Formatter& error_msg) const noexcept { - // TODO decide if correct xml format must be checked in this function - // Check string - // if (raw.is_set()) - // { - // fastrtps::xmlparser::up_base_node_t _; - // fastrtps::xmlparser::XMLP_ret ret = fastrtps::xmlparser::XMLParser::loadXML(raw, _); - // if (ret != fastrtps::xmlparser::XMLP_ret::XML_OK) - // { - // error_msg << "String " << raw.get_reference() << " is not a valid XML configuration. "; - // return false; - // } - // } - // Check files for (const auto& file : files) { From 45b0a98c421d878e42a41a53cfa7766ea54cc221 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 17 Jun 2024 16:03:35 +0200 Subject: [PATCH 09/53] Regenerate types Signed-off-by: Lucia Echevarria --- .../logging/LogEntryTypeObjectSupport.cxx | 13 ++++---- .../MonitoringStatusTypeObjectSupport.cxx | 14 ++++----- .../MonitoringTopicsTypeObjectSupport.cxx | 31 +++++++++---------- .../arrays_and_sequencesTypeObjectSupport.cxx | 14 ++++----- .../basic_array_structTypeObjectSupport.cxx | 12 +++---- .../basic_structTypeObjectSupport.cxx | 8 ++--- .../char_sequenceTypeObjectSupport.cxx | 4 +-- ...complex_nested_arraysTypeObjectSupport.cxx | 24 +++++++------- .../enum_structTypeObjectSupport.cxx | 6 ++-- ...loat_bounded_sequenceTypeObjectSupport.cxx | 4 +-- .../hello_worldTypeObjectSupport.cxx | 6 ++-- .../map_structTypeObjectSupport.cxx | 4 +-- .../numeric_arrayTypeObjectSupport.cxx | 4 +-- .../union_structTypeObjectSupport.cxx | 16 +++++----- 14 files changed, 77 insertions(+), 83 deletions(-) diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx index 868bc39e..4aabf72a 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryTypeObjectSupport.cxx @@ -106,9 +106,8 @@ void register_LogEntry_type_identifier( "LogEntry", type_ids_LogEntry); if (eprosima::fastdds::dds::RETCODE_OK != return_code_LogEntry) { - StructTypeFlag struct_flags_LogEntry = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_LogEntry = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - static_cast(return_code_LogEntry); QualifiedTypeName type_name_LogEntry = "LogEntry"; eprosima::fastcdr::optional type_ann_builtin_LogEntry; eprosima::fastcdr::optional ann_custom_LogEntry; @@ -129,7 +128,7 @@ void register_LogEntry_type_identifier( "event Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_event = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_event = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, true, false); MemberId member_id_event = 0x00000000; bool common_event_ec {false}; @@ -170,7 +169,7 @@ void register_LogEntry_type_identifier( { ::register_Kind_type_identifier(type_ids_kind); } - StructMemberFlag member_flags_kind = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_kind = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_kind = 0x00000001; bool common_kind_ec {false}; @@ -208,7 +207,7 @@ void register_LogEntry_type_identifier( } } } - StructMemberFlag member_flags_category = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_category = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_category = 0x00000002; bool common_category_ec {false}; @@ -246,7 +245,7 @@ void register_LogEntry_type_identifier( } } } - StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_message = 0x00000003; bool common_message_ec {false}; @@ -284,7 +283,7 @@ void register_LogEntry_type_identifier( } } } - StructMemberFlag member_flags_timestamp = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_timestamp = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_timestamp = 0x00000004; bool common_timestamp_ec {false}; diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx index f6452e94..de488fdc 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusTypeObjectSupport.cxx @@ -49,9 +49,8 @@ void register_MonitoringErrorStatus_type_identifier( "MonitoringErrorStatus", type_ids_MonitoringErrorStatus); if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitoringErrorStatus) { - StructTypeFlag struct_flags_MonitoringErrorStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_MonitoringErrorStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - static_cast(return_code_MonitoringErrorStatus); QualifiedTypeName type_name_MonitoringErrorStatus = "MonitoringErrorStatus"; eprosima::fastcdr::optional type_ann_builtin_MonitoringErrorStatus; eprosima::fastcdr::optional ann_custom_MonitoringErrorStatus; @@ -72,7 +71,7 @@ void register_MonitoringErrorStatus_type_identifier( "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_type_mismatch = 0x00000000; bool common_type_mismatch_ec {false}; @@ -102,7 +101,7 @@ void register_MonitoringErrorStatus_type_identifier( "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_qos_mismatch = 0x00000001; bool common_qos_mismatch_ec {false}; @@ -139,9 +138,8 @@ void register_MonitoringStatus_type_identifier( "MonitoringStatus", type_ids_MonitoringStatus); if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitoringStatus) { - StructTypeFlag struct_flags_MonitoringStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_MonitoringStatus = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - static_cast(return_code_MonitoringStatus); QualifiedTypeName type_name_MonitoringStatus = "MonitoringStatus"; eprosima::fastcdr::optional type_ann_builtin_MonitoringStatus; eprosima::fastcdr::optional ann_custom_MonitoringStatus; @@ -160,7 +158,7 @@ void register_MonitoringStatus_type_identifier( { ::register_MonitoringErrorStatus_type_identifier(type_ids_error_status); } - StructMemberFlag member_flags_error_status = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_error_status = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_error_status = 0x00000000; bool common_error_status_ec {false}; @@ -190,7 +188,7 @@ void register_MonitoringStatus_type_identifier( "has_errors Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_has_errors = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_has_errors = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_has_errors = 0x00000001; bool common_has_errors_ec {false}; diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx index 7ff982ae..9c4af3c2 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.cxx @@ -49,9 +49,8 @@ void register_DdsTopicData_type_identifier( "DdsTopicData", type_ids_DdsTopicData); if (eprosima::fastdds::dds::RETCODE_OK != return_code_DdsTopicData) { - StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_DdsTopicData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - static_cast(return_code_DdsTopicData); QualifiedTypeName type_name_DdsTopicData = "DdsTopicData"; eprosima::fastcdr::optional type_ann_builtin_DdsTopicData; eprosima::fastcdr::optional ann_custom_DdsTopicData; @@ -80,7 +79,7 @@ void register_DdsTopicData_type_identifier( } } } - StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_participant_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_participant_id = 0x00000000; bool common_participant_id_ec {false}; @@ -110,7 +109,7 @@ void register_DdsTopicData_type_identifier( "msgs_lost Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_msgs_lost = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_msgs_lost = 0x00000001; bool common_msgs_lost_ec {false}; @@ -140,7 +139,7 @@ void register_DdsTopicData_type_identifier( "msgs_received Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_msgs_received = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_msgs_received = 0x00000002; bool common_msgs_received_ec {false}; @@ -170,7 +169,7 @@ void register_DdsTopicData_type_identifier( "msg_rx_rate Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_msg_rx_rate = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_msg_rx_rate = 0x00000003; bool common_msg_rx_rate_ec {false}; @@ -207,9 +206,8 @@ void register_DdsTopic_type_identifier( "DdsTopic", type_ids_DdsTopic); if (eprosima::fastdds::dds::RETCODE_OK != return_code_DdsTopic) { - StructTypeFlag struct_flags_DdsTopic = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_DdsTopic = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - static_cast(return_code_DdsTopic); QualifiedTypeName type_name_DdsTopic = "DdsTopic"; eprosima::fastcdr::optional type_ann_builtin_DdsTopic; eprosima::fastcdr::optional ann_custom_DdsTopic; @@ -238,7 +236,7 @@ void register_DdsTopic_type_identifier( } } } - StructMemberFlag member_flags_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_name = 0x00000000; bool common_name_ec {false}; @@ -276,7 +274,7 @@ void register_DdsTopic_type_identifier( } } } - StructMemberFlag member_flags_type_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_type_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_type_name = 0x00000001; bool common_type_name_ec {false}; @@ -306,7 +304,7 @@ void register_DdsTopic_type_identifier( "type_discovered Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_type_discovered = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_type_discovered = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_type_discovered = 0x00000002; bool common_type_discovered_ec {false}; @@ -336,7 +334,7 @@ void register_DdsTopic_type_identifier( "type_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_type_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_type_mismatch = 0x00000003; bool common_type_mismatch_ec {false}; @@ -366,7 +364,7 @@ void register_DdsTopic_type_identifier( "qos_mismatch Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_qos_mismatch = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_qos_mismatch = 0x00000004; bool common_qos_mismatch_ec {false}; @@ -426,7 +424,7 @@ void register_DdsTopic_type_identifier( } } } - StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_data = 0x00000005; bool common_data_ec {false}; @@ -463,9 +461,8 @@ void register_MonitoringTopics_type_identifier( "MonitoringTopics", type_ids_MonitoringTopics); if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitoringTopics) { - StructTypeFlag struct_flags_MonitoringTopics = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_MonitoringTopics = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); - static_cast(return_code_MonitoringTopics); QualifiedTypeName type_name_MonitoringTopics = "MonitoringTopics"; eprosima::fastcdr::optional type_ann_builtin_MonitoringTopics; eprosima::fastcdr::optional ann_custom_MonitoringTopics; @@ -516,7 +513,7 @@ void register_MonitoringTopics_type_identifier( } } } - StructMemberFlag member_flags_topics = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_topics = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_topics = 0x00000000; bool common_topics_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx index 2f05a271..06defd21 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_AnInternalObject_type_identifier( "AnInternalObject", type_ids_AnInternalObject); if (eprosima::fastdds::dds::RETCODE_OK != return_code_AnInternalObject) { - StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; @@ -71,7 +71,7 @@ void register_AnInternalObject_type_identifier( "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_x = 0x00000000; bool common_x_ec {false}; @@ -101,7 +101,7 @@ void register_AnInternalObject_type_identifier( "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_positive = 0x00000001; bool common_positive_ec {false}; @@ -138,7 +138,7 @@ void register_arrays_and_sequences_type_identifier( "arrays_and_sequences", type_ids_arrays_and_sequences); if (eprosima::fastdds::dds::RETCODE_OK != return_code_arrays_and_sequences) { - StructTypeFlag struct_flags_arrays_and_sequences = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_arrays_and_sequences = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_arrays_and_sequences = "arrays_and_sequences"; eprosima::fastcdr::optional type_ann_builtin_arrays_and_sequences; @@ -190,7 +190,7 @@ void register_arrays_and_sequences_type_identifier( } } } - StructMemberFlag member_flags_unlimited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_unlimited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_unlimited_vector = 0x00000000; bool common_unlimited_vector_ec {false}; @@ -250,7 +250,7 @@ void register_arrays_and_sequences_type_identifier( } } } - StructMemberFlag member_flags_limited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_limited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_limited_vector = 0x00000001; bool common_limited_vector_ec {false}; @@ -312,7 +312,7 @@ void register_arrays_and_sequences_type_identifier( } } } - StructMemberFlag member_flags_limited_array = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_limited_array = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_limited_array = 0x00000002; bool common_limited_array_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx index c31d8a40..242ea811 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_TheOtherObjectInArray_type_identifier( "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObjectInArray) { - StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_TheOtherObjectInArray = "TheOtherObjectInArray"; eprosima::fastcdr::optional type_ann_builtin_TheOtherObjectInArray; @@ -71,7 +71,7 @@ void register_TheOtherObjectInArray_type_identifier( "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_some_num = 0x00000000; bool common_some_num_ec {false}; @@ -101,7 +101,7 @@ void register_TheOtherObjectInArray_type_identifier( "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_positive = 0x00000001; bool common_positive_ec {false}; @@ -138,7 +138,7 @@ void register_basic_array_struct_type_identifier( "basic_array_struct", type_ids_basic_array_struct); if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_array_struct) { - StructTypeFlag struct_flags_basic_array_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_basic_array_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_basic_array_struct = "basic_array_struct"; eprosima::fastcdr::optional type_ann_builtin_basic_array_struct; @@ -160,7 +160,7 @@ void register_basic_array_struct_type_identifier( "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_index = 0x00000000; bool common_index_ec {false}; @@ -222,7 +222,7 @@ void register_basic_array_struct_type_identifier( } } } - StructMemberFlag member_flags_sub_structs = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_sub_structs = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_sub_structs = 0x00000001; bool common_sub_structs_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx index 1d0cc939..b57ea0db 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_TheOtherObject_type_identifier( "TheOtherObject", type_ids_TheOtherObject); if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObject) { - StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_TheOtherObject = "TheOtherObject"; eprosima::fastcdr::optional type_ann_builtin_TheOtherObject; @@ -71,7 +71,7 @@ void register_TheOtherObject_type_identifier( "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_some_num = 0x00000000; bool common_some_num_ec {false}; @@ -108,7 +108,7 @@ void register_basic_struct_type_identifier( "basic_struct", type_ids_basic_struct); if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_struct) { - StructTypeFlag struct_flags_basic_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_basic_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_basic_struct = "basic_struct"; eprosima::fastcdr::optional type_ann_builtin_basic_struct; @@ -128,7 +128,7 @@ void register_basic_struct_type_identifier( { ::register_TheOtherObject_type_identifier(type_ids_sub_struct); } - StructMemberFlag member_flags_sub_struct = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_sub_struct = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_sub_struct = 0x00000000; bool common_sub_struct_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx index 86259c1a..24ddf288 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_char_sequence_type_identifier( "char_sequence", type_ids_char_sequence); if (eprosima::fastdds::dds::RETCODE_OK != return_code_char_sequence) { - StructTypeFlag struct_flags_char_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_char_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_char_sequence = "char_sequence"; eprosima::fastcdr::optional type_ann_builtin_char_sequence; @@ -103,7 +103,7 @@ void register_char_sequence_type_identifier( } } } - StructMemberFlag member_flags_chars = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_chars = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_chars = 0x00000000; bool common_chars_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx index d60a7f72..2e9d0cf4 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_ThirdLevelElement_type_identifier( "ThirdLevelElement", type_ids_ThirdLevelElement); if (eprosima::fastdds::dds::RETCODE_OK != return_code_ThirdLevelElement) { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; @@ -71,7 +71,7 @@ void register_ThirdLevelElement_type_identifier( "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_x = 0x00000000; bool common_x_ec {false}; @@ -101,7 +101,7 @@ void register_ThirdLevelElement_type_identifier( "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_y = 0x00000001; bool common_y_ec {false}; @@ -138,7 +138,7 @@ void register_SecondLevelElement_type_identifier( "SecondLevelElement", type_ids_SecondLevelElement); if (eprosima::fastdds::dds::RETCODE_OK != return_code_SecondLevelElement) { - StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; @@ -158,7 +158,7 @@ void register_SecondLevelElement_type_identifier( { ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); } - StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_an_element_alone = 0x00000000; bool common_an_element_alone_ec {false}; @@ -218,7 +218,7 @@ void register_SecondLevelElement_type_identifier( } } } - StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_a_limited_other_value = 0x00000001; bool common_a_limited_other_value_ec {false}; @@ -255,7 +255,7 @@ void register_FirstLevelElement_type_identifier( "FirstLevelElement", type_ids_FirstLevelElement); if (eprosima::fastdds::dds::RETCODE_OK != return_code_FirstLevelElement) { - StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_FirstLevelElement = "FirstLevelElement"; eprosima::fastcdr::optional type_ann_builtin_FirstLevelElement; @@ -285,7 +285,7 @@ void register_FirstLevelElement_type_identifier( } } } - StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_useless_name = 0x00000000; bool common_useless_name_ec {false}; @@ -345,7 +345,7 @@ void register_FirstLevelElement_type_identifier( } } } - StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_sub = 0x00000001; bool common_sub_ec {false}; @@ -373,7 +373,7 @@ void register_FirstLevelElement_type_identifier( { ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); } - StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_an_element_alone = 0x00000002; bool common_an_element_alone_ec {false}; @@ -410,7 +410,7 @@ void register_complex_nested_arrays_type_identifier( "complex_nested_arrays", type_ids_complex_nested_arrays); if (eprosima::fastdds::dds::RETCODE_OK != return_code_complex_nested_arrays) { - StructTypeFlag struct_flags_complex_nested_arrays = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_complex_nested_arrays = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_complex_nested_arrays = "complex_nested_arrays"; eprosima::fastcdr::optional type_ann_builtin_complex_nested_arrays; @@ -464,7 +464,7 @@ void register_complex_nested_arrays_type_identifier( } } } - StructMemberFlag member_flags_array_of_elements = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_array_of_elements = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_array_of_elements = 0x00000000; bool common_array_of_elements_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx index 22969762..642e3524 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx @@ -106,7 +106,7 @@ void register_enum_struct_type_identifier( "enum_struct", type_ids_enum_struct); if (eprosima::fastdds::dds::RETCODE_OK != return_code_enum_struct) { - StructTypeFlag struct_flags_enum_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_enum_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_enum_struct = "enum_struct"; eprosima::fastcdr::optional type_ann_builtin_enum_struct; @@ -128,7 +128,7 @@ void register_enum_struct_type_identifier( "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_index = 0x00000000; bool common_index_ec {false}; @@ -156,7 +156,7 @@ void register_enum_struct_type_identifier( { ::register_ColorEnum_type_identifier(type_ids_enum_value); } - StructMemberFlag member_flags_enum_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_enum_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_enum_value = 0x00000001; bool common_enum_value_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx index 01905db3..aa6108f6 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_float_bounded_sequence_type_identifier( "float_bounded_sequence", type_ids_float_bounded_sequence); if (eprosima::fastdds::dds::RETCODE_OK != return_code_float_bounded_sequence) { - StructTypeFlag struct_flags_float_bounded_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_float_bounded_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_float_bounded_sequence = "float_bounded_sequence"; eprosima::fastcdr::optional type_ann_builtin_float_bounded_sequence; @@ -103,7 +103,7 @@ void register_float_bounded_sequence_type_identifier( } } } - StructMemberFlag member_flags_numbers = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_numbers = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_numbers = 0x00000000; bool common_numbers_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx index 5933c4db..1c19ab81 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_hello_world_type_identifier( "hello_world", type_ids_hello_world); if (eprosima::fastdds::dds::RETCODE_OK != return_code_hello_world) { - StructTypeFlag struct_flags_hello_world = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_hello_world = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_hello_world = "hello_world"; eprosima::fastcdr::optional type_ann_builtin_hello_world; @@ -71,7 +71,7 @@ void register_hello_world_type_identifier( "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_index = 0x00000000; bool common_index_ec {false}; @@ -109,7 +109,7 @@ void register_hello_world_type_identifier( } } } - StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_message = 0x00000001; bool common_message_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx index 0d23ae09..e4d4e981 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_map_struct_type_identifier( "map_struct", type_ids_map_struct); if (eprosima::fastdds::dds::RETCODE_OK != return_code_map_struct) { - StructTypeFlag struct_flags_map_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_map_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_map_struct = "map_struct"; eprosima::fastcdr::optional type_ann_builtin_map_struct; @@ -138,7 +138,7 @@ void register_map_struct_type_identifier( } } } - StructMemberFlag member_flags_my_map = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_my_map = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_my_map = 0x00000000; bool common_my_map_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx index 8f4b9e2f..22b35f27 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx @@ -49,7 +49,7 @@ void register_numeric_array_type_identifier( "numeric_array", type_ids_numeric_array); if (eprosima::fastdds::dds::RETCODE_OK != return_code_numeric_array) { - StructTypeFlag struct_flags_numeric_array = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_numeric_array = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_numeric_array = "numeric_array"; eprosima::fastcdr::optional type_ann_builtin_numeric_array; @@ -105,7 +105,7 @@ void register_numeric_array_type_identifier( } } } - StructMemberFlag member_flags_points = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_points = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_points = 0x00000000; bool common_points_ec {false}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx index 3f613bd2..fd7ed407 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx @@ -48,14 +48,14 @@ void register_MyUnion_type_identifier( "MyUnion", type_ids_MyUnion); if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) { - UnionTypeFlag union_flags_MyUnion = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + UnionTypeFlag union_flags_MyUnion = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_MyUnion = "MyUnion"; eprosima::fastcdr::optional type_ann_builtin_MyUnion; eprosima::fastcdr::optional ann_custom_MyUnion; CompleteTypeDetail detail_MyUnion = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MyUnion, ann_custom_MyUnion, type_name_MyUnion.to_string()); CompleteUnionHeader header_MyUnion = TypeObjectUtils::build_complete_union_header(detail_MyUnion); - UnionDiscriminatorFlag member_flags_MyUnion = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + UnionDiscriminatorFlag member_flags_MyUnion = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false); return_code_MyUnion = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( @@ -98,7 +98,7 @@ void register_MyUnion_type_identifier( "octet_value Union member TypeIdentifier unknown to TypeObjectRegistry."); return; } - UnionMemberFlag member_flags_octet_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + UnionMemberFlag member_flags_octet_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false); UnionCaseLabelSeq label_seq_octet_value; TypeObjectUtils::add_union_case_label(label_seq_octet_value, static_cast(1)); @@ -130,7 +130,7 @@ void register_MyUnion_type_identifier( "long_value Union member TypeIdentifier unknown to TypeObjectRegistry."); return; } - UnionMemberFlag member_flags_long_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + UnionMemberFlag member_flags_long_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false); UnionCaseLabelSeq label_seq_long_value; TypeObjectUtils::add_union_case_label(label_seq_long_value, static_cast(2)); @@ -170,7 +170,7 @@ void register_MyUnion_type_identifier( } } } - UnionMemberFlag member_flags_string_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + UnionMemberFlag member_flags_string_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false); UnionCaseLabelSeq label_seq_string_value; TypeObjectUtils::add_union_case_label(label_seq_string_value, static_cast(3)); @@ -212,7 +212,7 @@ void register_union_struct_type_identifier( "union_struct", type_ids_union_struct); if (eprosima::fastdds::dds::RETCODE_OK != return_code_union_struct) { - StructTypeFlag struct_flags_union_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::NOT_APPLIED, + StructTypeFlag struct_flags_union_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, false, false); QualifiedTypeName type_name_union_struct = "union_struct"; eprosima::fastcdr::optional type_ann_builtin_union_struct; @@ -234,7 +234,7 @@ void register_union_struct_type_identifier( "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); return; } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_index = 0x00000000; bool common_index_ec {false}; @@ -262,7 +262,7 @@ void register_union_struct_type_identifier( { ::register_MyUnion_type_identifier(type_ids_union_value); } - StructMemberFlag member_flags_union_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructKind::NOT_APPLIED, + StructMemberFlag member_flags_union_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, false, false, false, false); MemberId member_id_union_value = 0x00000001; bool common_union_value_ec {false}; From 848fc9938d9853c863aebf98513870c89206187c Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Thu, 20 Jun 2024 14:44:54 +0200 Subject: [PATCH 10/53] Fix compilation after rebase to fastdds master Signed-off-by: Lucia Echevarria --- .../efficiency/payload/CopyPayloadPool.hpp | 9 +- .../efficiency/payload/FastPayloadPool.hpp | 13 +- .../efficiency/payload/MapPayloadPool.hpp | 9 +- .../efficiency/payload/PayloadPool.hpp | 284 +++++++++-------- .../payload/PayloadPoolMediator.hpp | 11 +- .../efficiency/payload/CopyPayloadPool.cpp | 11 +- .../efficiency/payload/FastPayloadPool.cpp | 17 +- .../cpp/efficiency/payload/MapPayloadPool.cpp | 20 +- .../cpp/efficiency/payload/PayloadPool.cpp | 116 +++---- .../payload/PayloadPoolMediator.cpp | 17 +- .../test/unittest/efficiency/CMakeLists.txt | 3 - .../efficiency/FastPayloadPoolTest.cpp | 19 +- .../efficiency/MapPayloadPoolTest.cpp | 74 ++--- .../unittest/efficiency/PayloadPoolTest.cpp | 285 +++++++++--------- .../dynamic_types/DynTypesParticipant.hpp | 6 +- .../participant/rtps/CommonParticipant.hpp | 10 +- .../reader/rtps/CommonReader.hpp | 7 +- .../writer/rpc/SimpleWriter.hpp | 1 - .../writer/rtps/CommonWriter.hpp | 1 - .../writer/rtps/SimpleWriter.hpp | 1 - .../cpp/participant/dds/XmlParticipant.cpp | 18 +- .../dynamic_types/DynTypesParticipant.cpp | 10 +- .../participant/rtps/CommonParticipant.cpp | 9 +- .../src/cpp/reader/rtps/CommonReader.cpp | 30 +- .../src/cpp/types/dds/TopicDataType.cpp | 5 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 6 +- 26 files changed, 471 insertions(+), 521 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp index 0dd16a70..8d8318ce 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp @@ -35,17 +35,16 @@ class CopyPayloadPool : public PayloadPool //! Reserve a new memory space bool get_payload( uint32_t size, - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; //! Reserve a new memory space and copy the data from \c src_payload to \c target_payload bool get_payload( - const types::Payload& src_payload, - IPayloadPool*& data_owner, - types::Payload& target_payload) override; + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) override; //! Release data in \c payload bool release_payload( - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; }; } /* namespace core */ diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp index c338e1ff..0a914f3b 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp @@ -76,7 +76,7 @@ class FastPayloadPool : public PayloadPool DDSPIPE_CORE_DllAPI bool get_payload( uint32_t size, - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; /** * Reserve in \c target_payload the payload in \c src_payload . @@ -95,9 +95,8 @@ class FastPayloadPool : public PayloadPool */ DDSPIPE_CORE_DllAPI bool get_payload( - const types::Payload& src_payload, - IPayloadPool*& data_owner, - types::Payload& target_payload) override; + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; /** * Release a payload that has been reserved from this pool. @@ -113,7 +112,7 @@ class FastPayloadPool : public PayloadPool */ DDSPIPE_CORE_DllAPI bool release_payload( - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; protected: @@ -132,7 +131,7 @@ class FastPayloadPool : public PayloadPool DDSPIPE_CORE_DllAPI virtual bool reserve_( uint32_t size, - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; /** * @brief Reimplement parent \c release_ method @@ -146,7 +145,7 @@ class FastPayloadPool : public PayloadPool */ DDSPIPE_CORE_DllAPI virtual bool release_( - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; }; } /* namespace core */ diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp index ee2a3801..f65f78b6 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp @@ -59,7 +59,7 @@ class MapPayloadPool : public PayloadPool */ bool get_payload( uint32_t size, - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; /** * @brief Set \c target_payload data to \c src_payload . @@ -78,9 +78,8 @@ class MapPayloadPool : public PayloadPool * @throw utils::InconsistencyException if \c data_owner is \c this but the data in \c src_payload is not from this pool. */ bool get_payload( - const types::Payload& src_payload, - IPayloadPool*& data_owner, - types::Payload& target_payload) override; + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; /** * @brief Decrease reference counter for data in \c payload . @@ -96,7 +95,7 @@ class MapPayloadPool : public PayloadPool * @throw utils::InconsistencyException if the data in \c payload is not from this pool. */ bool release_payload( - types::Payload& payload) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; protected: diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp index bc3ca8b6..12dcffa9 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp @@ -50,152 +50,144 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool DDSPIPE_CORE_DllAPI virtual ~PayloadPool(); - ///// - // FAST DDS PART - - /** - * @brief Reserve in \c cache_change a new payload of max size \c size . - * - * It sets values to the serialized payload inside \c cache_change . - * This method calls \c get_payload for the serialized payload. - * The \c cache_change owner is set to \c this . - * - * @warning length value in \c payload is not modified. - * - * @note This method may reserve new memory. - * - * @param [in] size : Size in bytes of the payload that will be reserved - * @param [out] cache_change : the cache change which SerializedPayload will be set - * - * @return true if everything ok - * @return false if something went wrong - * - * @pre Fields @c cache_change must not have the serialized payload initialized. - */ - DDSPIPE_CORE_DllAPI - virtual bool get_payload( - uint32_t size, - eprosima::fastrtps::rtps::CacheChange_t& cache_change) override; // TODO add noexcept once is implemented - - /** - * @brief Store in \c cache_change the \c data payload. - * - * This method set \c cache_change serialized payload to the same data in \c data . - * This method should reuse \c data and not copy it in case the owner of \c data is \c this . - * It sets values to the serialized payload inside \c cache_change . - * - * This method calls \c get_payload for the serialized payload. - * The \c cache_change owner is set to \c this . - * - * @note This method may reserve new memory in case the owner is not \c this . - * - * @param [in,out] data Serialized payload received - * @param [in,out] data_owner Payload pool owning incoming data \c data - * @param [in,out] cache_change Cache change to assign the payload to - * - * @warning @c data_owner can only be changed from @c nullptr to @c this. If a value different from - * @c nullptr is received it should be left unchanged. - * - * @return true if everything ok - * @return false if something went wrong - * - * @pre Fields @c cache_change must not have the serialized payload initialized. - */ - DDSPIPE_CORE_DllAPI - virtual bool get_payload( - eprosima::fastrtps::rtps::SerializedPayload_t& data, - IPayloadPool*& data_owner, - eprosima::fastrtps::rtps::CacheChange_t& cache_change) override; // TODO add noexcept once is implemented - - /** - * @brief Release the data from the serialized payload inside \c cache_change . - * - * @note This method must only release the actual memory of a data in case nobody is referencing it anymore. - * - * This method calls \c release_payload for the serialized payload. - * The \c cache_change owner is set to \c nullptr . - * - * @param [in,out] cache_change Cache change to release the payload from - * - * @return true if everything ok - * @return false if something went wrong - * - * @throw IncosistencyException if cache change owner is other than this - */ - DDSPIPE_CORE_DllAPI - virtual bool release_payload( - eprosima::fastrtps::rtps::CacheChange_t& cache_change) override; // TODO add noexcept once is implemented - - ///// + // ///// + // // FAST DDS PART + + // /** + // * @brief Reserve a new \c payload of max size \c size . + // * + // * This method calls \c get_payload for the serialized payload. + // * The \c payload owner is set to \c this . + // * + // * @warning length value in \c payload is not modified. + // * + // * @note This method may reserve new memory. + // * + // * @param [in] size : Size in bytes of the payload that will be reserved + // * @param [out] cache_change : the cache change which SerializedPayload will be set + // * + // * @return true if everything ok + // * @return false if something went wrong + // * + // */ + // DDSPIPE_CORE_DllAPI + // virtual bool get_payload( + // uint32_t size, + // eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented + + // /** + // * @brief Assign to \c payload the \c data payload. + // * + // * This method should reuse \c data and not copy it in case the owner of \c data is \c this . + // * It sets values to the serialized \c payload . + // * + // * This method calls \c get_payload for the serialized payload. + // * The \c payload owner is set to \c this . + // * + // * @note This method may reserve new memory in case the owner is not \c this . + // * + // * @param [in,out] data Serialized payload received + // * @param [in,out] payload Cache change to assign the payload to + // * + // * + // * @return true if everything ok + // * @return false if something went wrong + // * + // */ + // DDSPIPE_CORE_DllAPI + // virtual bool get_payload( + // eprosima::fastrtps::rtps::SerializedPayload_t& data, + // eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented + + // /** + // * @brief Release the data from the serialized \c payload . + // * + // * @note This method must only release the actual memory of a data in case nobody is referencing it anymore. + // * + // * This method calls \c release_payload for the serialized payload. + // * The \c payload owner is set to \c nullptr . + // * + // * @param [in,out] payload to release + // * + // * @return true if everything ok + // * @return false if something went wrong + // * + // * @throw IncosistencyException if cache change owner is other than this + // */ + // DDSPIPE_CORE_DllAPI + // virtual bool release_payload( + // eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented + + // /// // DDSPIPE PART - /** - * @brief Reserve a new data in \c payload of size \c size. - * - * It sets value \c max_size and \c data of \c payload . - * - * @note This method may reserve new memory. - * - * @warning length value in \c payload is not modified. - * - * @param [in] size : Size in bytes of the payload that will be reserved - * @param [out] payload : the SerializedPayload that will be set - * - * @return true if everything ok - * @return false if something went wrong - * - * @pre Fields @c payload must not have been initialized. - */ - DDSPIPE_CORE_DllAPI - virtual bool get_payload( - uint32_t size, - types::Payload& payload) = 0; - - /** - * @brief Store in \c target_payload the data from \c src_payload . - * - * This method set \c target_payload fields \c max_size , \c lenght and \c data . - * This method "should" reuse data in \c src_payload and not copy it in case \c data_owner is \c this . - * - * @note This method may reserve new memory in case the owner is not \c this . - * - * @param [in] src_payload Payload to move to target - * @param [in,out] data_owner Payload pool owning incoming data \c src_payload - * @param [out] target_payload Payload to assign the payload to - * - * @warning @c data_owner can only be changed from @c nullptr to @c this. If a value different from - * @c nullptr is received it must be left unchanged. - * - * @return true if everything ok - * @return false if something went wrong - * - * @pre Fields @c target_payload must not have been initialized. - */ - DDSPIPE_CORE_DllAPI - virtual bool get_payload( - const types::Payload& src_payload, - IPayloadPool*& data_owner, - types::Payload& target_payload) = 0; - - /** - * @brief Release the data from the \c payload . - * - * @note This method must only release the actual memory of a data in case nobody is referencing it anymore. - * - * @note This method should use method \c reserve_ to reserve new memory. - * - * Reset the \c payload info. - * - * @param [in,out] payload Payload to release data from - * - * @return true if everything ok - * @return false if something went wrong - * - * @pre @c payload must have been initialized from this pool. - */ - DDSPIPE_CORE_DllAPI - virtual bool release_payload( - types::Payload& payload) = 0; + // /** + // * @brief Reserve a new data in \c payload of size \c size. + // * + // * It sets value \c max_size and \c data of \c payload . + // * + // * @note This method may reserve new memory. + // * + // * @warning length value in \c payload is not modified. + // * + // * @param [in] size : Size in bytes of the payload that will be reserved + // * @param [out] payload : the SerializedPayload that will be set + // * + // * @return true if everything ok + // * @return false if something went wrong + // * + // * @pre Fields @c payload must not have been initialized. + // */ + // DDSPIPE_CORE_DllAPI + // virtual bool get_payload( + // uint32_t size, + // types::Payload& payload) = 0; + + // /** + // * @brief Store in \c target_payload the data from \c src_payload . + // * + // * This method set \c target_payload fields \c max_size , \c lenght and \c data . + // * This method "should" reuse data in \c src_payload and not copy it in case \c data_owner is \c this . + // * + // * @note This method may reserve new memory in case the owner is not \c this . + // * + // * @param [in] src_payload Payload to move to target + // * @param [in,out] data_owner Payload pool owning incoming data \c src_payload + // * @param [out] target_payload Payload to assign the payload to + // * + // * @warning @c data_owner can only be changed from @c nullptr to @c this. If a value different from + // * @c nullptr is received it must be left unchanged. + // * + // * @return true if everything ok + // * @return false if something went wrong + // * + // * @pre Fields @c target_payload must not have been initialized. + // */ + // DDSPIPE_CORE_DllAPI + // virtual bool get_payload( + // const types::Payload& src_payload, + // IPayloadPool*& data_owner, + // types::Payload& target_payload) = 0; + + // /** + // * @brief Release the data from the \c payload . + // * + // * @note This method must only release the actual memory of a data in case nobody is referencing it anymore. + // * + // * @note This method should use method \c reserve_ to reserve new memory. + // * + // * Reset the \c payload info. + // * + // * @param [in,out] payload Payload to release data from + // * + // * @return true if everything ok + // * @return false if something went wrong + // * + // * @pre @c payload must have been initialized from this pool. + // */ + // DDSPIPE_CORE_DllAPI + // virtual bool release_payload( + // types::Payload& payload) = 0; //! Wether every payload get has been released. DDSPIPE_CORE_DllAPI @@ -217,7 +209,7 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool DDSPIPE_CORE_DllAPI virtual bool reserve_( uint32_t size, - types::Payload& payload); + eprosima::fastrtps::rtps::SerializedPayload_t& payload); /** * @brief Free a memory space. @@ -233,7 +225,7 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool */ DDSPIPE_CORE_DllAPI virtual bool release_( - types::Payload& payload); + eprosima::fastrtps::rtps::SerializedPayload_t& payload); //! Increase \c reserve_count_ DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp index 61c2864f..1335e20d 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp @@ -137,7 +137,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool DDSPIPE_CORE_DllAPI virtual bool get_payload( uint32_t size, - fastrtps::rtps::CacheChange_t& cache_change) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; /** * @brief redirect the call to the \c release_payload in the \c payload_pool. @@ -151,9 +151,8 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool */ DDSPIPE_CORE_DllAPI virtual bool get_payload( - fastrtps::rtps::SerializedPayload_t& data, - fastrtps::rtps::IPayloadPool*& data_owner, - fastrtps::rtps::CacheChange_t& cache_change) override; + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) override; /** * @brief redirect the call to the \c release_payload in the \c payload_pool. @@ -164,7 +163,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool */ DDSPIPE_CORE_DllAPI virtual bool release_payload( - fastrtps::rtps::CacheChange_t& cache_change) override; + eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; protected: @@ -172,7 +171,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool std::mutex mutex_; //! A pointer to the payload_ we want to write down in the PayloadPool. - types::Payload* payload_; + eprosima::fastrtps::rtps::SerializedPayload_t* payload_; //! The \c PayloadPool the \c PayloadPoolMediator is mediating for. const std::shared_ptr& payload_pool_; diff --git a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp index a0a55e10..e3d91c5d 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp @@ -28,22 +28,19 @@ using namespace eprosima::ddspipe::core::types; bool CopyPayloadPool::get_payload( uint32_t size, - Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { reserve_(size, payload); payload.max_size = size; + payload.payload_owner = this; return true; } bool CopyPayloadPool::get_payload( - const Payload& src_payload, - IPayloadPool*& data_owner, - Payload& target_payload) + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) { - // As this class copies always the data, it does not matter the owner of this data - static_cast(data_owner); - if (!get_payload(src_payload.max_size, target_payload)) { return false; diff --git a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp index 8a46072d..56a7cae5 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp @@ -31,19 +31,18 @@ using namespace eprosima::ddspipe::core::types; bool FastPayloadPool::get_payload( uint32_t size, - Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { // Reserve new payload return reserve_(size, payload); } bool FastPayloadPool::get_payload( - const Payload& src_payload, - IPayloadPool*& data_owner, - Payload& target_payload) + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) { // If we are not the owner, create a new payload. Else, reference the existing one - if (data_owner != this) + if (src_payload.payload_owner != this) { logDebug(DDSPIPE_PAYLOADPOOL_FAST, "Copying payload with ptr: " << static_cast(src_payload.data) << "."); @@ -74,6 +73,7 @@ bool FastPayloadPool::get_payload( target_payload.data = src_payload.data; target_payload.length = src_payload.length; target_payload.max_size = src_payload.max_size; + target_payload.payload_owner = src_payload.payload_owner; } return true; } @@ -100,6 +100,7 @@ bool FastPayloadPool::release_payload( payload.length = 0; payload.max_size = 0; payload.data = nullptr; + payload.payload_owner = nullptr; payload.pos = 0; return true; @@ -107,7 +108,7 @@ bool FastPayloadPool::release_payload( bool FastPayloadPool::reserve_( uint32_t size, - types::Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { if (size == 0) { @@ -125,6 +126,7 @@ bool FastPayloadPool::reserve_( payload.data = reinterpret_cast(reference_place + 1); payload.max_size = size; + payload.payload_owner = this; add_reserved_payload_(); @@ -134,7 +136,7 @@ bool FastPayloadPool::reserve_( } bool FastPayloadPool::release_( - types::Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { logDebug(DDSPIPE_PAYLOADPOOL_FAST, "Releasing payload ptr: " << static_cast(payload.data) << "."); @@ -147,6 +149,7 @@ bool FastPayloadPool::release_( payload.length = 0; payload.max_size = 0; payload.data = nullptr; + payload.payload_owner = nullptr; payload.pos = 0; add_release_payload_(); diff --git a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp index e6d13980..1ae76aef 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp @@ -43,7 +43,7 @@ MapPayloadPool::~MapPayloadPool() bool MapPayloadPool::get_payload( uint32_t size, - Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { // Reserve new payload if (!reserve_(size, payload)) @@ -51,23 +51,21 @@ bool MapPayloadPool::get_payload( return false; } payload.max_size = size; + payload.payload_owner = this; // Store this payload in map - { - std::lock_guard lock(reserved_payloads_mutex_); - reserved_payloads_[payload.data] = 1; - } + std::lock_guard lock(reserved_payloads_mutex_); + reserved_payloads_[payload.data] = 1; return true; } bool MapPayloadPool::get_payload( - const Payload& src_payload, - IPayloadPool*& data_owner, - Payload& target_payload) + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) { // If we are not the owner, create a new payload. Else, reference the existing one - if (data_owner != this) + if (src_payload.payload_owner != this) { // Store space for payload if (!get_payload(src_payload.max_size, target_payload)) @@ -98,12 +96,13 @@ bool MapPayloadPool::get_payload( target_payload.data = src_payload.data; target_payload.length = src_payload.length; target_payload.max_size = src_payload.max_size; + target_payload.payload_owner = this; } return true; } bool MapPayloadPool::release_payload( - Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { std::lock_guard lock(reserved_payloads_mutex_); @@ -134,6 +133,7 @@ bool MapPayloadPool::release_payload( payload.length = 0; payload.pos = 0; payload.max_size = 0; + payload.payload_owner = nullptr; payload.data = nullptr; return true; diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index 7eb71f73..2debec23 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -55,61 +55,61 @@ PayloadPool::~PayloadPool() ///// // FAST DDS PART -bool PayloadPool::get_payload( - uint32_t size, - eprosima::fastrtps::rtps::CacheChange_t& cache_change) -{ - if (get_payload(size, cache_change.serializedPayload)) - { - cache_change.payload_owner(this); - return true; - } - else - { - logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while creating payload.") - return false; - } -} - -bool PayloadPool::get_payload( - fastrtps::rtps::SerializedPayload_t& data, - IPayloadPool*& data_owner, - eprosima::fastrtps::rtps::CacheChange_t& cache_change) -{ - if (get_payload(data, data_owner, cache_change.serializedPayload)) - { - cache_change.payload_owner(this); - return true; - } - else - { - logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while referencing payload.") - return false; - } -} - -bool PayloadPool::release_payload( - fastrtps::rtps::CacheChange_t& cache_change) -{ - if (cache_change.payload_owner() == this) - { - if (release_payload(cache_change.serializedPayload)) - { - cache_change.payload_owner(nullptr); - return true; - } - else - { - logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while releasing payload.") - return false; - } - } - else - { - logError(DDSPIPE_PAYLOADPOOL, "Trying to remove a cache change in an incorrect pool.") - throw utils::InconsistencyException("Trying to remove a cache change in an incorrect pool."); - } -} +// bool PayloadPool::get_payload( +// uint32_t size, +// eprosima::fastrtps::rtps::CacheChange_t& cache_change) +// { +// if (get_payload(size, cache_change.serializedPayload)) +// { +// cache_change.payload_owner(this); +// return true; +// } +// else +// { +// logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while creating payload.") +// return false; +// } +// } + +// bool PayloadPool::get_payload( +// fastrtps::rtps::SerializedPayload_t& data, +// IPayloadPool*& data_owner, +// eprosima::fastrtps::rtps::CacheChange_t& cache_change) +// { +// if (get_payload(data, data_owner, cache_change.serializedPayload)) +// { +// cache_change.payload_owner(this); +// return true; +// } +// else +// { +// logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while referencing payload.") +// return false; +// } +// } + +// bool PayloadPool::release_payload( +// fastrtps::rtps::CacheChange_t& cache_change) +// { +// if (cache_change.payload_owner() == this) +// { +// if (release_payload(cache_change.serializedPayload)) +// { +// cache_change.payload_owner(nullptr); +// return true; +// } +// else +// { +// logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while releasing payload.") +// return false; +// } +// } +// else +// { +// logError(DDSPIPE_PAYLOADPOOL, "Trying to remove a cache change in an incorrect pool.") +// throw utils::InconsistencyException("Trying to remove a cache change in an incorrect pool."); +// } +// } bool PayloadPool::is_clean() const noexcept { @@ -137,7 +137,7 @@ void PayloadPool::add_release_payload_() bool PayloadPool::reserve_( uint32_t size, - Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { if (size == 0) { @@ -156,10 +156,12 @@ bool PayloadPool::reserve_( } bool PayloadPool::release_( - Payload& payload) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { logDebug(DDSPIPE_PAYLOADPOOL, "Releasing payload ptr: " << payload.data << "."); + payload.payload_owner = nullptr; + payload.empty(); if (payload.data != nullptr) diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp index 8207436a..532e8b14 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp @@ -73,25 +73,22 @@ fastdds::dds::ReturnCode_t PayloadPoolMediator::write( bool PayloadPoolMediator::get_payload( uint32_t size, - fastrtps::rtps::CacheChange_t& cache_change) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { - fastrtps::rtps::IPayloadPool* payload_owner{payload_pool_.get()}; - - return get_payload(*payload_, payload_owner, cache_change); + return get_payload(*payload_, payload); } bool PayloadPoolMediator::get_payload( - fastrtps::rtps::SerializedPayload_t& data, - fastrtps::rtps::IPayloadPool*& data_owner, - fastrtps::rtps::CacheChange_t& cache_change) + const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, + eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) { - return payload_pool_->get_payload(data, data_owner, cache_change); + return payload_pool_->get_payload(src_payload, target_payload); } bool PayloadPoolMediator::release_payload( - fastrtps::rtps::CacheChange_t& cache_change) + eprosima::fastrtps::rtps::SerializedPayload_t& payload) { - return payload_pool_->release_payload(cache_change); + return payload_pool_->release_payload(payload); } } /* namespace core */ diff --git a/ddspipe_core/test/unittest/efficiency/CMakeLists.txt b/ddspipe_core/test/unittest/efficiency/CMakeLists.txt index 1dfa874e..e71bc729 100644 --- a/ddspipe_core/test/unittest/efficiency/CMakeLists.txt +++ b/ddspipe_core/test/unittest/efficiency/CMakeLists.txt @@ -30,9 +30,6 @@ set(TEST_LIST release reserve_and_release_counter is_clean - get_payload_cache_change - get_payload_from_src_cache_change - release_payload_cache_change ) set(TEST_EXTRA_LIBRARIES diff --git a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp index 7fd3d31a..c0a1092f 100644 --- a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp @@ -70,7 +70,7 @@ void get_release( eprosima::fastrtps::rtps::IPayloadPool* payload_owner = static_cast(&pool); Payload dst_payload; - ASSERT_TRUE(pool.get_payload(src_payload, payload_owner, dst_payload)); + ASSERT_TRUE(pool.get_payload(src_payload, dst_payload)); ASSERT_TRUE(pool.release_payload(dst_payload)); } @@ -155,13 +155,13 @@ TEST(FastPayloadPoolTest, get_payload_from_src) ASSERT_EQ(pool_->pointers_stored(), 1u); // get payload1 from src payload0 - ASSERT_TRUE(pool_->get_payload(payload0, pool, payload1)); + ASSERT_TRUE(pool_->get_payload(payload0, payload1)); ASSERT_EQ(pool_->pointers_stored(), 1u); ASSERT_EQ(payload1.max_size, payload0.max_size); ASSERT_EQ(payload1.data, payload0.data); // get payload2 from src payload1 - ASSERT_TRUE(pool_->get_payload(payload1, pool, payload2)); + ASSERT_TRUE(pool_->get_payload(payload1, payload2)); ASSERT_EQ(pool_->pointers_stored(), 1u); ASSERT_EQ(payload2.max_size, payload0.max_size); ASSERT_EQ(payload2.data, payload0.data); @@ -171,7 +171,7 @@ TEST(FastPayloadPoolTest, get_payload_from_src) ASSERT_EQ(pool_->pointers_stored(), 1u); // get payload3 from src payload1 - ASSERT_TRUE(pool_->get_payload(payload1, pool, payload3)); + ASSERT_TRUE(pool_->get_payload(payload1, payload3)); ASSERT_EQ(pool_->pointers_stored(), 1u); ASSERT_EQ(payload3.max_size, payload1.max_size); ASSERT_EQ(payload3.data, payload1.data); @@ -181,7 +181,7 @@ TEST(FastPayloadPoolTest, get_payload_from_src) ASSERT_EQ(pool_->pointers_stored(), 2u); // get payload5 from src payload4 - ASSERT_TRUE(pool_->get_payload(payload4, pool, payload5)); + ASSERT_TRUE(pool_->get_payload(payload4, payload5)); ASSERT_EQ(pool_->pointers_stored(), 2u); ASSERT_EQ(payload5.max_size, payload4.max_size); ASSERT_EQ(payload5.data, payload4.data); @@ -227,7 +227,7 @@ TEST(FastPayloadPoolTest, get_payload_from_src_no_owner) ASSERT_EQ(pool_->pointers_stored(), 0u); // get payload from src payload aux - ASSERT_TRUE(pool_->get_payload(payload_src, pool_aux, payload_target)); + ASSERT_TRUE(pool_->get_payload(payload_src, payload_target)); ASSERT_EQ(pool_->pointers_stored(), 1u); // release payload aux from pool aux @@ -263,7 +263,6 @@ TEST(FastPayloadPoolTest, get_payload_from_src_negative) ASSERT_FALSE( pool_->get_payload( payload_src, - pool_aux, payload_target)); delete pool; @@ -292,7 +291,7 @@ TEST(FastPayloadPoolTest, release_payload) // get N-1 payloads from first for (unsigned int i = 1; i < TEST_NUMBER; i++) { - pool_->get_payload(payloads[0], pool, payloads[i]); + pool_->get_payload(payloads[0], payloads[i]); } // release N-2 payloads @@ -304,7 +303,7 @@ TEST(FastPayloadPoolTest, release_payload) // get N-2 more payloads from first for (unsigned int i = 2; i < TEST_NUMBER; i++) { - pool_->get_payload(payloads[0], pool, payloads[i]); + pool_->get_payload(payloads[0], payloads[i]); } // release N payloads @@ -397,7 +396,7 @@ TEST(FastPayloadPoolTest, concurrent_release) eprosima::fastrtps::rtps::IPayloadPool* payload_owner = static_cast(&pool); Payload dst_payload; - ASSERT_TRUE(pool.get_payload(payload, payload_owner, dst_payload)); + ASSERT_TRUE(pool.get_payload(payload, dst_payload)); std::thread t1(test::release, std::ref(pool), std::ref(dst_payload)); diff --git a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp index d8cc5409..6e027b9f 100644 --- a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp @@ -51,15 +51,15 @@ class MockMapPayloadPool : public MapPayloadPool } uint64_t reference_count( - const Payload& payload) + const eprosima::fastrtps::rtps::SerializedPayload_t& payload) { return reserved_payloads_[payload.data]; } void clean_all( - std::vector& payloads) + std::vector& payloads) { - for (Payload& payload : payloads) + for (eprosima::fastrtps::rtps::SerializedPayload_t& payload : payloads) { release_payload(payload); } @@ -88,7 +88,7 @@ TEST(MapPayloadPoolTest, get_payload) // Get N different pointers { test::MockMapPayloadPool pool; - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); for (unsigned int i = 0; i < TEST_NUMBER; i++) { @@ -106,7 +106,7 @@ TEST(MapPayloadPoolTest, get_payload) // fail reserve memory { test::MockMapPayloadPool pool; - Payload payload; + eprosima::fastrtps::rtps::SerializedPayload_t payload; ASSERT_FALSE(pool.get_payload(0, payload)); } @@ -130,12 +130,12 @@ TEST(MapPayloadPoolTest, get_payload_from_src) eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - Payload payload0; - Payload payload1; - Payload payload2; - Payload payload3; - Payload payload4; - Payload payload5; + eprosima::fastrtps::rtps::SerializedPayload_t payload0; + eprosima::fastrtps::rtps::SerializedPayload_t payload1; + eprosima::fastrtps::rtps::SerializedPayload_t payload2; + eprosima::fastrtps::rtps::SerializedPayload_t payload3; + eprosima::fastrtps::rtps::SerializedPayload_t payload4; + eprosima::fastrtps::rtps::SerializedPayload_t payload5; // get payload0 ASSERT_TRUE(pool_->get_payload(DEFAULT_SIZE, payload0)); @@ -143,14 +143,14 @@ TEST(MapPayloadPoolTest, get_payload_from_src) ASSERT_EQ(pool_->reference_count(payload0), 1u); // get payload1 from src payload0 - ASSERT_TRUE(pool_->get_payload(payload0, pool, payload1)); + ASSERT_TRUE(pool_->get_payload(payload0, payload1)); ASSERT_EQ(pool_->pointers_stored(), 1u); ASSERT_EQ(pool_->reference_count(payload1), 2u); ASSERT_EQ(payload1.max_size, payload0.max_size); ASSERT_EQ(payload1.data, payload0.data); // get payload2 from src payload1 - ASSERT_TRUE(pool_->get_payload(payload1, pool, payload2)); + ASSERT_TRUE(pool_->get_payload(payload1, payload2)); ASSERT_EQ(pool_->pointers_stored(), 1u); ASSERT_EQ(pool_->reference_count(payload2), 3u); ASSERT_EQ(payload2.max_size, payload0.max_size); @@ -162,7 +162,7 @@ TEST(MapPayloadPoolTest, get_payload_from_src) ASSERT_EQ(pool_->reference_count(payload2), 2u); // get payload3 from src payload1 - ASSERT_TRUE(pool_->get_payload(payload1, pool, payload3)); + ASSERT_TRUE(pool_->get_payload(payload1, payload3)); ASSERT_EQ(pool_->pointers_stored(), 1u); ASSERT_EQ(pool_->reference_count(payload3), 3u); ASSERT_EQ(payload3.max_size, payload1.max_size); @@ -175,7 +175,7 @@ TEST(MapPayloadPoolTest, get_payload_from_src) ASSERT_EQ(pool_->reference_count(payload4), 1u); // get payload5 from src payload4 - ASSERT_TRUE(pool_->get_payload(payload4, pool, payload5)); + ASSERT_TRUE(pool_->get_payload(payload4, payload5)); ASSERT_EQ(pool_->pointers_stored(), 2u); ASSERT_EQ(pool_->reference_count(payload1), 3u); ASSERT_EQ(pool_->reference_count(payload5), 2u); @@ -214,8 +214,8 @@ TEST(MapPayloadPoolTest, get_payload_from_src_no_owner) eprosima::fastrtps::rtps::IPayloadPool* pool_aux = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_aux_ = static_cast(pool_aux); - Payload payload_src; - Payload payload_target; + eprosima::fastrtps::rtps::SerializedPayload_t payload_src; + eprosima::fastrtps::rtps::SerializedPayload_t payload_target; // get payload aux from pool aux pool_aux_->get_payload(DEFAULT_SIZE, payload_src); @@ -223,7 +223,7 @@ TEST(MapPayloadPoolTest, get_payload_from_src_no_owner) ASSERT_EQ(pool_->pointers_stored(), 0u); // get payload from src payload aux - ASSERT_TRUE(pool_->get_payload(payload_src, pool_aux, payload_target)); + ASSERT_TRUE(pool_->get_payload(payload_src, payload_target)); ASSERT_EQ(pool_->pointers_stored(), 1u); // release payload aux from pool aux @@ -243,48 +243,22 @@ TEST(MapPayloadPoolTest, get_payload_from_src_no_owner) * Check negative cases for get_payload from source * * CASES: - * The source says the owner is the same pool, but is not * Source has size 0 and different owner */ TEST(MapPayloadPoolTest, get_payload_from_src_negative) { - // The source says the owner is the same pool, but is not - { - // 1 log error expected - INSTANTIATE_LOG_TESTER(eprosima::utils::Log::Kind::Error, 1, 1); - - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload - test::MockMapPayloadPool* pool_ = static_cast(pool); - test::MockMapPayloadPool pool_aux; - - Payload payload_src; - Payload payload_target; - - // Get payload for source - pool_aux.get_payload(DEFAULT_SIZE, payload_src); - - // In a different pool, try to source it as if it was from same pool - ASSERT_THROW(pool_->get_payload(payload_src, pool, payload_target), eprosima::utils::InconsistencyException); - - // END : release payload - pool_aux.release_payload(payload_src); - - delete pool; - } - // Source has size 0 and different owner { eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); eprosima::fastrtps::rtps::IPayloadPool* pool_aux = nullptr; // nullptr - Payload payload_src; - Payload payload_target; + eprosima::fastrtps::rtps::SerializedPayload_t payload_src; + eprosima::fastrtps::rtps::SerializedPayload_t payload_target; ASSERT_FALSE( pool_->get_payload( payload_src, - pool_aux, payload_target)); delete pool; @@ -305,7 +279,7 @@ TEST(MapPayloadPoolTest, release_payload) { eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); // get first payload pool_->get_payload(DEFAULT_SIZE, payloads[0]); @@ -313,7 +287,7 @@ TEST(MapPayloadPoolTest, release_payload) // get N-1 payloads from first for (unsigned int i = 1; i < TEST_NUMBER; i++) { - pool_->get_payload(payloads[0], pool, payloads[i]); + pool_->get_payload(payloads[0], payloads[i]); ASSERT_EQ(pool_->reference_count(payloads[0]), i + 1) << i; } @@ -327,7 +301,7 @@ TEST(MapPayloadPoolTest, release_payload) // get N-2 more payloads from first for (unsigned int i = 2; i < TEST_NUMBER; i++) { - pool_->get_payload(payloads[0], pool, payloads[i]); + pool_->get_payload(payloads[0], payloads[i]); ASSERT_EQ(pool_->reference_count(payloads[0]), i + 1) << i; } @@ -358,7 +332,7 @@ TEST(MapPayloadPoolTest, release_payload_negative) test::MockMapPayloadPool pool; test::MockMapPayloadPool pool_aux; - Payload payload; + eprosima::fastrtps::rtps::SerializedPayload_t payload; pool_aux.get_payload(DEFAULT_SIZE, payload); diff --git a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp index b673a49b..77811952 100644 --- a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp @@ -51,7 +51,7 @@ namespace rtps { * In googletest-distribution release-1.10.0 this does not happen. */ void PrintTo( - const SerializedPayload_t, + const SerializedPayload_t&, std::ostream* os) { *os << "::eprosima::fastrtps::rtps::SerializedPayload_t"; @@ -88,7 +88,7 @@ class MockPayloadPool : public PayloadPool MOCK_METHOD( bool, get_payload, - (uint32_t size, eprosima::ddspipe::core::types::Payload& target_payload), + (uint32_t size, eprosima::fastrtps::rtps::SerializedPayload_t& target_payload), (override)); MOCK_METHOD( @@ -96,15 +96,14 @@ class MockPayloadPool : public PayloadPool get_payload, ( const Payload& src_payload, - eprosima::fastrtps::rtps::IPayloadPool*&data_owner, - eprosima::ddspipe::core::types::Payload& target_payload + eprosima::fastrtps::rtps::SerializedPayload_t& target_payload ), (override)); MOCK_METHOD( bool, release_payload, - (eprosima::ddspipe::core::types::Payload& target_payload), + (eprosima::fastrtps::rtps::SerializedPayload_t& target_payload), (override)); }; @@ -329,144 +328,144 @@ TEST(PayloadPoolTest, is_clean) ASSERT_TRUE(pool.is_clean()); } -/** - * Test get_payload cache_change fails if the child class fails - * - * CASES: - * - get_payload for payload goes ok - * - get_payload for payload fails - */ -TEST(PayloadPoolTest, get_payload_cache_change) -{ - // get_payload for payload goes ok - { - test::MockPayloadPool pool; - eprosima::fastrtps::rtps::CacheChange_t cc; - - EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(true)); - - EXPECT_TRUE(pool.get_payload(sizeof(PayloadUnit), cc)); - - // Clean cache change correctly so process dont break - cc.payload_owner(nullptr); - } - - // get_payload for payload goes ok - { - test::MockPayloadPool pool; - eprosima::fastrtps::rtps::CacheChange_t cc; - - EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(false)); - - EXPECT_FALSE(pool.get_payload(sizeof(PayloadUnit), cc)); - } -} - -/** - * Test get_payload cache_change with source fails if the child class fails - * - * CASES: - * - get_payload for payload goes ok - * - get_payload for payload fails - */ -TEST(PayloadPoolTest, get_payload_from_src_cache_change) -{ - // get_payload for payload goes ok - { - test::MockPayloadPool pool; - eprosima::fastrtps::rtps::CacheChange_t target; - Payload source; - eprosima::fastrtps::rtps::IPayloadPool* aux_pool; - - EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(true)); - - EXPECT_TRUE(pool.get_payload(source, aux_pool, target)); - - // Clean cache change correctly so process dont break - target.payload_owner(nullptr); - } -} - -/** - * Test get_payload cache_change with source fails if the child class fails - * - * CASES: - * - get_payload for payload fails - */ -TEST(PayloadPoolTest, get_payload_from_src_cache_change_negative) -{ - // get_payload for payload fails - { - test::MockPayloadPool pool; - eprosima::fastrtps::rtps::CacheChange_t target; - Payload source; - eprosima::fastrtps::rtps::IPayloadPool* aux_pool; - - EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(false)); - - EXPECT_FALSE(pool.get_payload(source, aux_pool, target)); - } -} - -/** - * Test release_payload cache_change method using MockPayloadPool when inside get_payload method fails - * - * CASES: - * different ownership - * this ownership release ok - */ -TEST(PayloadPoolTest, release_payload_cache_change) -{ - // this ownership release ok - { - test::MockPayloadPool pool; - eprosima::fastrtps::rtps::CacheChange_t cc; - - // ownership must be this pool - cc.payload_owner(&pool); - - EXPECT_CALL(pool, release_payload(_)).Times(1).WillOnce(Return(true)); - - EXPECT_TRUE(pool.release_payload(cc)); - } -} - -/** - * Test release_payload cache_change method from a different owner - * - * CASES: - * this ownership release fail - */ -TEST(PayloadPoolTest, release_payload_cache_change_negative) -{ - // different ownership - { - // 1 log error expected - INSTANTIATE_LOG_TESTER(eprosima::utils::Log::Kind::Error, 1, 1); - - test::MockPayloadPool pool; - eprosima::fastrtps::rtps::CacheChange_t cc; - cc.payload_owner(nullptr); - - EXPECT_THROW(pool.release_payload(cc), eprosima::utils::InconsistencyException); - } - - // this ownership release fail - { - test::MockPayloadPool pool; - eprosima::fastrtps::rtps::CacheChange_t cc; - - // ownership must be this pool - cc.payload_owner(&pool); - - EXPECT_CALL(pool, release_payload(_)).Times(1).WillOnce(Return(false)); - - EXPECT_FALSE(pool.release_payload(cc)); - - // Clean cache change correctly so process dont break - cc.payload_owner(nullptr); - } -} +// /** +// * Test get_payload cache_change fails if the child class fails +// * +// * CASES: +// * - get_payload for payload goes ok +// * - get_payload for payload fails +// */ +// TEST(PayloadPoolTest, get_payload_cache_change) +// { +// // get_payload for payload goes ok +// { +// test::MockPayloadPool pool; +// eprosima::fastrtps::rtps::CacheChange_t cc; + +// EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(true)); + +// EXPECT_TRUE(pool.get_payload(sizeof(PayloadUnit), cc)); + +// // Clean cache change correctly so process dont break +// cc.payload_owner(nullptr); +// } + +// // get_payload for payload goes ok +// { +// test::MockPayloadPool pool; +// eprosima::fastrtps::rtps::CacheChange_t cc; + +// EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(false)); + +// EXPECT_FALSE(pool.get_payload(sizeof(PayloadUnit), cc)); +// } +// } + +// /** +// * Test get_payload cache_change with source fails if the child class fails +// * +// * CASES: +// * - get_payload for payload goes ok +// * - get_payload for payload fails +// */ +// TEST(PayloadPoolTest, get_payload_from_src_cache_change) +// { +// // get_payload for payload goes ok +// { +// test::MockPayloadPool pool; +// eprosima::fastrtps::rtps::CacheChange_t target; +// Payload source; +// eprosima::fastrtps::rtps::IPayloadPool* aux_pool; + +// EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(true)); + +// EXPECT_TRUE(pool.get_payload(source, aux_pool, target)); + +// // Clean cache change correctly so process dont break +// target.payload_owner(nullptr); +// } +// } + +// /** +// * Test get_payload cache_change with source fails if the child class fails +// * +// * CASES: +// * - get_payload for payload fails +// */ +// TEST(PayloadPoolTest, get_payload_from_src_cache_change_negative) +// { +// // get_payload for payload fails +// { +// test::MockPayloadPool pool; +// eprosima::fastrtps::rtps::CacheChange_t target; +// Payload source; +// eprosima::fastrtps::rtps::IPayloadPool* aux_pool; + +// EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(false)); + +// EXPECT_FALSE(pool.get_payload(source, aux_pool, target)); +// } +// } + +// /** +// * Test release_payload cache_change method using MockPayloadPool when inside get_payload method fails +// * +// * CASES: +// * different ownership +// * this ownership release ok +// */ +// TEST(PayloadPoolTest, release_payload_cache_change) +// { +// // this ownership release ok +// { +// test::MockPayloadPool pool; +// eprosima::fastrtps::rtps::CacheChange_t cc; + +// // ownership must be this pool +// cc.payload_owner(&pool); + +// EXPECT_CALL(pool, release_payload(_)).Times(1).WillOnce(Return(true)); + +// EXPECT_TRUE(pool.release_payload(cc)); +// } +// } + +// /** +// * Test release_payload cache_change method from a different owner +// * +// * CASES: +// * this ownership release fail +// */ +// TEST(PayloadPoolTest, release_payload_cache_change_negative) +// { +// // different ownership +// { +// // 1 log error expected +// INSTANTIATE_LOG_TESTER(eprosima::utils::Log::Kind::Error, 1, 1); + +// test::MockPayloadPool pool; +// eprosima::fastrtps::rtps::CacheChange_t cc; +// cc.payload_owner(nullptr); + +// EXPECT_THROW(pool.release_payload(cc), eprosima::utils::InconsistencyException); +// } + +// // this ownership release fail +// { +// test::MockPayloadPool pool; +// eprosima::fastrtps::rtps::CacheChange_t cc; + +// // ownership must be this pool +// cc.payload_owner(&pool); + +// EXPECT_CALL(pool, release_payload(_)).Times(1).WillOnce(Return(false)); + +// EXPECT_FALSE(pool.release_payload(cc)); + +// // Clean cache change correctly so process dont break +// cc.payload_owner(nullptr); +// } +// } int main( int argc, diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 3a39a418..2c206425 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -81,12 +81,14 @@ class DynTypesParticipant : public rtps::SimpleParticipant DDSPIPE_PARTICIPANTS_DllAPI void onReaderDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info) override; + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool& should_be_ignored) override; DDSPIPE_PARTICIPANTS_DllAPI void onWriterDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info) override; + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool& should_be_ignored) override; protected: diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index 27829bd9..185025ae 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -129,7 +128,8 @@ class CommonParticipant DDSPIPE_PARTICIPANTS_DllAPI virtual void onParticipantDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info) override; + fastrtps::rtps::ParticipantDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; /** * @brief Override method from \c RTPSParticipantListener . @@ -139,7 +139,8 @@ class CommonParticipant DDSPIPE_PARTICIPANTS_DllAPI virtual void onReaderDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info) override; + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; /** * @brief Override method from \c RTPSParticipantListener . @@ -149,7 +150,8 @@ class CommonParticipant DDSPIPE_PARTICIPANTS_DllAPI virtual void onWriterDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info) override; + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool& /*should_be_ignored*/) override; ////////////////// // STATIC METHODS diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index e0244456..d251e592 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -96,7 +95,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener * @param [in] change new change received */ DDSPIPE_PARTICIPANTS_DllAPI - void onNewCacheChangeAdded( + void on_new_cache_change_added( fastrtps::rtps::RTPSReader*, const fastrtps::rtps::CacheChange_t* const change) noexcept override; @@ -109,9 +108,9 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener * @param [in] info information about the matched Writer */ DDSPIPE_PARTICIPANTS_DllAPI - void onReaderMatched( + void on_reader_matched( fastrtps::rtps::RTPSReader*, - fastrtps::rtps::MatchingInfo& info) noexcept override; + const fastrtps::rtps::MatchingInfo& info) noexcept override; /** * This method is called when a new Writer is discovered, with a Topic that diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp index c701021b..81fe1069 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp @@ -14,7 +14,6 @@ #pragma once -#include #include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index b6029d34..cc250aa1 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp index b23741d2..a7ad3f6f 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp @@ -14,7 +14,6 @@ #pragma once -#include #include #include #include diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index 851ed9a9..b57c6ac2 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -16,7 +16,7 @@ #include #include -#include +// #include #include #include @@ -39,14 +39,14 @@ XmlParticipant::XmlParticipant( : CommonParticipant(participant_configuration, payload_pool, discovery_database) , xml_specific_configuration_(*reinterpret_cast(configuration_.get())) { - fastdds::dds::DomainParticipantExtendedQos extended_qos; - if (xml_specific_configuration_.participant_profile.is_set() && - fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( - xml_specific_configuration_.participant_profile.get_value(), - extended_qos)) - { - configuration_->domain = extended_qos.domainId(); - } + // fastdds::dds::DomainParticipantExtendedQos extended_qos; + // if (xml_specific_configuration_.participant_profile.is_set() && + // fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( + // xml_specific_configuration_.participant_profile.get_value(), + // extended_qos)) + // { + // configuration_->domain = extended_qos.domainId(); + // } } std::shared_ptr XmlParticipant::create_writer( diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 4783be75..4e391d12 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -92,7 +92,8 @@ std::shared_ptr DynTypesParticipant::create_reader( void DynTypesParticipant::onReaderDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info) + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool& should_be_ignored) { fastrtps::rtps::ReaderProxyData proxy_copy(info.info); @@ -100,14 +101,15 @@ void DynTypesParticipant::onReaderDiscovery( const auto type_info = proxy_copy.type_information().type_information; const auto type_name = proxy_copy.typeName(); - rtps::CommonParticipant::onReaderDiscovery(participant, std::move(info)); + rtps::CommonParticipant::onReaderDiscovery(participant, std::move(info), should_be_ignored); notify_type_discovered_(type_info, type_name); } void DynTypesParticipant::onWriterDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info) + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool& should_be_ignored) { fastrtps::rtps::WriterProxyData proxy_copy(info.info); @@ -115,7 +117,7 @@ void DynTypesParticipant::onWriterDiscovery( const auto type_info = proxy_copy.type_information().type_information; const auto type_name = proxy_copy.typeName(); - rtps::CommonParticipant::onWriterDiscovery(participant, std::move(info)); + rtps::CommonParticipant::onWriterDiscovery(participant, std::move(info), should_be_ignored); notify_type_discovered_(type_info, type_name); } diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 13ee2425..bbd66440 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -82,7 +82,8 @@ void CommonParticipant::init() void CommonParticipant::onParticipantDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info) + fastrtps::rtps::ParticipantDiscoveryInfo&& info, + bool&) { if (info.info.m_guid.guidPrefix != participant->getGuid().guidPrefix) { @@ -112,7 +113,8 @@ void CommonParticipant::onParticipantDiscovery( void CommonParticipant::onReaderDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info) + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool&) { if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) { @@ -150,7 +152,8 @@ void CommonParticipant::onReaderDiscovery( void CommonParticipant::onWriterDiscovery( fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info) + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool&) { if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) { diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index f44e103d..733160d6 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -68,7 +68,7 @@ CommonReader::~CommonReader() if (rtps_reader_) { // Unset listener before destruction (not necessary in principle, but just in case) - rtps_reader_->setListener(nullptr); + rtps_reader_->set_listener(nullptr); fastrtps::rtps::RTPSDomain::removeRTPSReader(rtps_reader_); } @@ -122,7 +122,7 @@ void CommonReader::internal_entities_creation_( // Set listener after entity creation to avoid SEGFAULT (produced when callback using rtps_reader_ is // invoked before the variable is fully set) - rtps_reader_->setListener(this); + rtps_reader_->set_listener(this); // Register reader with topic if (!rtps_participant_->registerReader(rtps_reader_, topic_attributes, reader_qos)) @@ -166,11 +166,9 @@ utils::ReturnCode CommonReader::take_nts_( return utils::ReturnCode::NO_DATA; } - fastrtps::rtps::CacheChange_t* received_change = nullptr; - fastrtps::rtps::WriterProxy* wp = nullptr; - // Read first change of the history - if (!rtps_reader_->nextUntakenCache(&received_change, &wp)) + auto received_change = rtps_reader_->next_untaken_cache(); + if (!received_change) { // Error reading. return utils::ReturnCode::ERROR; @@ -181,7 +179,7 @@ utils::ReturnCode CommonReader::take_nts_( if (ret != utils::ReturnCode::OK) { // Remove the change in the History and release it in the reader - rtps_reader_->getHistory()->remove_change(received_change); + rtps_reader_->get_history()->remove_change(received_change); return ret; } @@ -191,7 +189,7 @@ utils::ReturnCode CommonReader::take_nts_( data.reset(data_ptr); // Remove the change in the History and release it in the reader - rtps_reader_->getHistory()->remove_change(received_change); + rtps_reader_->get_history()->remove_change(received_change); return utils::ReturnCode::OK; } @@ -218,12 +216,8 @@ void CommonReader::fill_received_data_( // NOTE: in case of keyed topics an empty payload is possible if (received_change.serializedPayload.length > 0) { - eprosima::fastrtps::rtps::IPayloadPool* payload_owner = - const_cast(received_change.payload_owner()); - payload_pool_->get_payload( received_change.serializedPayload, - payload_owner, data_to_fill.payload); data_to_fill.payload_owner = payload_pool_.get(); @@ -316,7 +310,7 @@ fastrtps::rtps::ReaderAttributes CommonReader::reckon_reader_attributes_( att.endpoint.topicKind = eprosima::fastrtps::rtps::WITH_KEY; // If the topic has a key, request inline qos (containing the instance handle) - att.expectsInlineQos = true; + att.expects_inline_qos = true; } else { @@ -392,7 +386,7 @@ fastdds::dds::ReaderQos CommonReader::reckon_reader_qos_( return properties; } -void CommonReader::onNewCacheChangeAdded( +void CommonReader::on_new_cache_change_added( fastrtps::rtps::RTPSReader* reader, const fastrtps::rtps::CacheChange_t* const change) noexcept { @@ -414,7 +408,7 @@ void CommonReader::onNewCacheChangeAdded( // Remove received change if the CommonReader is disbled and the topic is not reliable if (!topic_.topic_qos.is_reliable()) { - reader->getHistory()->remove_change((fastrtps::rtps::CacheChange_t*)change); + reader->get_history()->remove_change((fastrtps::rtps::CacheChange_t*)change); logDebug(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Change removed from history"); } @@ -432,13 +426,13 @@ void CommonReader::onNewCacheChangeAdded( // WARNING: Removing an unacceptable change here is valid given that Fast-DDS internal reader's mutex is locked. // If the mutex wasn't locked, the track's transmit thread could take an unacceptable sample before it gets // deleted here. - reader->getHistory()->remove_change((fastrtps::rtps::CacheChange_t*)change); + reader->get_history()->remove_change((fastrtps::rtps::CacheChange_t*)change); } } -void CommonReader::onReaderMatched( +void CommonReader::on_reader_matched( fastrtps::rtps::RTPSReader*, - fastrtps::rtps::MatchingInfo& info) noexcept + const fastrtps::rtps::MatchingInfo& info) noexcept { if (!come_from_this_participant_(info.remoteEndpointGuid)) { diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index df97ad40..ea84bf52 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -86,10 +86,7 @@ bool TopicDataType::deserialize( DataType* target_payload = static_cast(data); // Get data and store it in PayloadPool - eprosima::fastrtps::rtps::IPayloadPool* payload_owner = - static_cast(payload_pool_.get()); - - payload_pool_->get_payload(*src_payload, payload_owner, target_payload->payload); + payload_pool_->get_payload(*src_payload, target_payload->payload); return true; } diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 1bb2121b..2fb0a508 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -233,11 +233,9 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( // Get the Payload without copy only if it has length if (data.payload.length > 0) { - eprosima::fastrtps::rtps::IPayloadPool* payload_owner = payload_pool_.get(); if (!payload_pool_->get_payload( - const_cast(data.payload), - payload_owner, - (*to_send_change_to_fill))) + const_cast(data.payload), + (to_send_change_to_fill->serializedPayload))) { logDevError(DDSPIPE_RTPS_COMMONWRITER, "Error getting Payload."); return utils::ReturnCode::ERROR; From 92917c386ef69ab8a32a7279db110bf8045f3670 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Wed, 26 Jun 2024 09:48:17 +0200 Subject: [PATCH 11/53] Continue rebasing to FastDDS master Signed-off-by: Lucia Echevarria --- .../communication/rpc/ServiceRegistry.hpp | 4 +- .../efficiency/payload/CopyPayloadPool.hpp | 8 +- .../efficiency/payload/FastPayloadPool.hpp | 14 +-- .../efficiency/payload/MapPayloadPool.hpp | 8 +- .../efficiency/payload/PayloadPool.hpp | 14 +-- .../payload/PayloadPoolMediator.hpp | 16 ++-- .../ddspipe_core/interface/IReader.hpp | 2 +- .../types/data/RpcPayloadData.hpp | 6 +- .../include/ddspipe_core/types/dds/Guid.hpp | 10 +- .../ddspipe_core/types/dds/GuidPrefix.hpp | 6 +- .../ddspipe_core/types/dds/Payload.hpp | 10 +- .../ddspipe_core/types/dds/TopicQoS.hpp | 4 +- .../ddspipe_core/types/logging/LogEntry.hpp | 2 +- .../types/logging/LogEntryPubSubTypes.h | 18 ++-- .../status/MonitoringStatusPubSubTypes.h | 36 ++++---- .../topics/MonitoringTopicsPubSubTypes.h | 54 +++++------ .../src/cpp/communication/rpc/RpcBridge.cpp | 4 +- .../efficiency/payload/CopyPayloadPool.cpp | 6 +- .../efficiency/payload/FastPayloadPool.cpp | 13 +-- .../cpp/efficiency/payload/MapPayloadPool.cpp | 8 +- .../cpp/efficiency/payload/PayloadPool.cpp | 12 +-- .../payload/PayloadPoolMediator.cpp | 12 +-- .../src/cpp/testing/random_values.cpp | 2 +- ddspipe_core/src/cpp/types/dds/Guid.cpp | 10 +- ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp | 6 +- ddspipe_core/src/cpp/types/dds/Payload.cpp | 2 +- .../cpp/types/logging/LogEntryPubSubTypes.cxx | 16 ++-- .../status/MonitoringStatusPubSubTypes.cxx | 28 +++--- .../topics/MonitoringTopicsPubSubTypes.cxx | 40 ++++---- .../efficiency/FastPayloadPoolTest.cpp | 20 ++-- .../efficiency/MapPayloadPoolTest.cpp | 46 +++++----- .../unittest/efficiency/PayloadPoolTest.cpp | 34 +++---- .../test/unittest/logging/constants.hpp | 2 +- .../test/unittest/monitoring/constants.hpp | 2 +- .../arrays_and_sequencesPubSubTypes.cxx | 28 +++--- .../arrays_and_sequencesPubSubTypes.h | 36 ++++---- .../basic_array_structPubSubTypes.cxx | 28 +++--- .../basic_array_structPubSubTypes.h | 36 ++++---- .../type_objects/basic_structPubSubTypes.cxx | 28 +++--- .../type_objects/basic_structPubSubTypes.h | 36 ++++---- .../type_objects/char_sequencePubSubTypes.cxx | 16 ++-- .../type_objects/char_sequencePubSubTypes.h | 18 ++-- .../complex_nested_arraysPubSubTypes.cxx | 52 +++++------ .../complex_nested_arraysPubSubTypes.h | 72 +++++++-------- .../types/type_objects/enum_struct.hpp | 2 +- .../type_objects/enum_structPubSubTypes.cxx | 16 ++-- .../type_objects/enum_structPubSubTypes.h | 18 ++-- .../float_bounded_sequencePubSubTypes.cxx | 16 ++-- .../float_bounded_sequencePubSubTypes.h | 18 ++-- .../type_objects/hello_worldPubSubTypes.cxx | 16 ++-- .../type_objects/hello_worldPubSubTypes.h | 18 ++-- .../type_objects/map_structPubSubTypes.cxx | 16 ++-- .../type_objects/map_structPubSubTypes.h | 18 ++-- .../type_objects/numeric_arrayPubSubTypes.cxx | 16 ++-- .../type_objects/numeric_arrayPubSubTypes.h | 18 ++-- .../type_objects/union_structPubSubTypes.cxx | 16 ++-- .../type_objects/union_structPubSubTypes.h | 18 ++-- .../test/unittest/types/endpoint/GuidTest.cpp | 20 ++-- .../cache_change/CacheChangePool.hpp | 12 +-- .../participant/dds/CommonParticipant.hpp | 6 +- .../dynamic_types/DynTypesParticipant.hpp | 8 +- .../participant/rtps/CommonParticipant.hpp | 24 ++--- .../rtps/DiscoveryServerParticipant.hpp | 2 +- .../rtps/InitialPeersParticipant.hpp | 2 +- .../participant/rtps/SimpleParticipant.hpp | 2 +- .../reader/auxiliar/BaseReader.hpp | 2 +- .../reader/auxiliar/BlankReader.hpp | 2 +- .../reader/rpc/SimpleReader.hpp | 6 +- .../reader/rtps/CommonReader.hpp | 64 ++++++------- .../reader/rtps/SimpleReader.hpp | 2 +- .../reader/rtps/SpecificQoSReader.hpp | 4 +- .../types/dds/RouterCacheChange.hpp | 6 +- .../types/dds/TopicDataType.hpp | 12 +-- .../ddspipe_participants/utils/utils.hpp | 8 +- .../writer/rpc/SimpleWriter.hpp | 8 +- .../writer/rtps/CommonWriter.hpp | 54 +++++------ .../writer/rtps/MultiWriter.hpp | 4 +- .../writer/rtps/QoSSpecificWriter.hpp | 2 +- .../writer/rtps/SimpleWriter.hpp | 2 +- .../writer/rtps/filter/RepeaterDataFilter.hpp | 4 +- .../writer/rtps/filter/SelfDataFilter.hpp | 4 +- .../cache_change/CacheChangePool.cpp | 8 +- .../cpp/participant/dds/CommonParticipant.cpp | 36 ++++---- .../cpp/participant/dds/XmlParticipant.cpp | 18 ++-- .../dynamic_types/DynTypesParticipant.cpp | 12 +-- .../participant/rtps/CommonParticipant.cpp | 54 +++++------ .../rtps/DiscoveryServerParticipant.cpp | 32 +++---- .../rtps/InitialPeersParticipant.cpp | 30 +++--- .../participant/rtps/SimpleParticipant.cpp | 18 ++-- .../src/cpp/reader/auxiliar/BaseReader.cpp | 2 +- .../src/cpp/reader/auxiliar/BlankReader.cpp | 2 +- .../src/cpp/reader/rpc/SimpleReader.cpp | 6 +- .../src/cpp/reader/rtps/CommonReader.cpp | 92 +++++++++---------- .../src/cpp/reader/rtps/SimpleReader.cpp | 2 +- .../src/cpp/reader/rtps/SpecificQoSReader.cpp | 4 +- .../src/cpp/types/address/Address.cpp | 8 +- .../src/cpp/types/dds/TopicDataType.cpp | 18 ++-- ddspipe_participants/src/cpp/utils/utils.cpp | 24 ++--- .../src/cpp/writer/dds/CommonWriter.cpp | 2 +- .../src/cpp/writer/rpc/SimpleWriter.cpp | 8 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 80 ++++++++-------- .../src/cpp/writer/rtps/MultiWriter.cpp | 2 +- .../src/cpp/writer/rtps/QoSSpecificWriter.cpp | 2 +- .../src/cpp/writer/rtps/SimpleWriter.cpp | 2 +- .../writer/rtps/filter/RepeaterDataFilter.cpp | 4 +- .../cpp/writer/rtps/filter/SelfDataFilter.cpp | 4 +- 106 files changed, 881 insertions(+), 880 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp b/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp index 21cce137..686cdba5 100644 --- a/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp +++ b/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp @@ -28,9 +28,9 @@ namespace eprosima { namespace ddspipe { namespace core { -using SampleIdentity = eprosima::fastrtps::rtps::SampleIdentity; +using SampleIdentity = eprosima::fastdds::rtps::SampleIdentity; -using SequenceNumber = eprosima::fastrtps::rtps::SequenceNumber_t; +using SequenceNumber = eprosima::fastdds::rtps::SequenceNumber_t; /** * Class used to store the information associated to a service request, so its reply can be forwarded through the diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp index 8d8318ce..23643de7 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/CopyPayloadPool.hpp @@ -35,16 +35,16 @@ class CopyPayloadPool : public PayloadPool //! Reserve a new memory space bool get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; //! Reserve a new memory space and copy the data from \c src_payload to \c target_payload bool get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) override; + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& target_payload) override; //! Release data in \c payload bool release_payload( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; }; } /* namespace core */ diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp index 0a914f3b..3690acae 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/FastPayloadPool.hpp @@ -38,7 +38,7 @@ typedef std::atomic MetaInfoType; * This class is used to manage the allocation and release of the payloads used within the Router. * The main target is not to copy or alloc data that is already in memory, but to reuse it safely. * - * This implementation uses an idea get from TopicPayloadPool from fastrtps. + * This implementation uses an idea get from TopicPayloadPool from fastdds. * This is, to alloc more space than required whenever a new payload is needed, and in this extra space (at the * beginning of the data) stores the number of references this data has. * As long as this number does not reach 0, the data is not deleted. @@ -76,7 +76,7 @@ class FastPayloadPool : public PayloadPool DDSPIPE_CORE_DllAPI bool get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; /** * Reserve in \c target_payload the payload in \c src_payload . @@ -95,8 +95,8 @@ class FastPayloadPool : public PayloadPool */ DDSPIPE_CORE_DllAPI bool get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; /** * Release a payload that has been reserved from this pool. @@ -112,7 +112,7 @@ class FastPayloadPool : public PayloadPool */ DDSPIPE_CORE_DllAPI bool release_payload( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; protected: @@ -131,7 +131,7 @@ class FastPayloadPool : public PayloadPool DDSPIPE_CORE_DllAPI virtual bool reserve_( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; /** * @brief Reimplement parent \c release_ method @@ -145,7 +145,7 @@ class FastPayloadPool : public PayloadPool */ DDSPIPE_CORE_DllAPI virtual bool release_( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; }; } /* namespace core */ diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp index f65f78b6..27ac2737 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/MapPayloadPool.hpp @@ -59,7 +59,7 @@ class MapPayloadPool : public PayloadPool */ bool get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; /** * @brief Set \c target_payload data to \c src_payload . @@ -78,8 +78,8 @@ class MapPayloadPool : public PayloadPool * @throw utils::InconsistencyException if \c data_owner is \c this but the data in \c src_payload is not from this pool. */ bool get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; /** * @brief Decrease reference counter for data in \c payload . @@ -95,7 +95,7 @@ class MapPayloadPool : public PayloadPool * @throw utils::InconsistencyException if the data in \c payload is not from this pool. */ bool release_payload( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; protected: diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp index 12dcffa9..a68c1629 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp @@ -38,7 +38,7 @@ namespace core { * Then, this payload will be moved to the Track. As the payload is already in the pool, there will be no copy. * Finally, the payload will be moved to every Writer that has to send the data (ideally without copy). */ -class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool +class PayloadPool : public eprosima::fastdds::rtps::IPayloadPool { public: @@ -73,7 +73,7 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool // DDSPIPE_CORE_DllAPI // virtual bool get_payload( // uint32_t size, - // eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented + // eprosima::fastdds::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented // /** // * @brief Assign to \c payload the \c data payload. @@ -96,8 +96,8 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool // */ // DDSPIPE_CORE_DllAPI // virtual bool get_payload( - // eprosima::fastrtps::rtps::SerializedPayload_t& data, - // eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented + // eprosima::fastdds::rtps::SerializedPayload_t& data, + // eprosima::fastdds::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented // /** // * @brief Release the data from the serialized \c payload . @@ -116,7 +116,7 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool // */ // DDSPIPE_CORE_DllAPI // virtual bool release_payload( - // eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented + // eprosima::fastdds::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented // /// // DDSPIPE PART @@ -209,7 +209,7 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool DDSPIPE_CORE_DllAPI virtual bool reserve_( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload); + eprosima::fastdds::rtps::SerializedPayload_t& payload); /** * @brief Free a memory space. @@ -225,7 +225,7 @@ class PayloadPool : public eprosima::fastrtps::rtps::IPayloadPool */ DDSPIPE_CORE_DllAPI virtual bool release_( - eprosima::fastrtps::rtps::SerializedPayload_t& payload); + eprosima::fastdds::rtps::SerializedPayload_t& payload); //! Increase \c reserve_count_ DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp index 1335e20d..ee6cbb8a 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp @@ -39,7 +39,7 @@ namespace core { * This class works as a mediator between the \c FastPayloadPool and the DataWriter's write functions, to avoid making * the extra copy. */ -class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool +class PayloadPoolMediator : public fastdds::rtps::IPayloadPool { public: @@ -97,7 +97,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool bool write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, - fastrtps::rtps::WriteParams& params); + fastdds::rtps::WriteParams& params); /** * @brief write \c data with a \c writer with a \c handle but avoiding copying the \c data from and to the same @@ -122,7 +122,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool fastdds::dds::ReturnCode_t write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, - const fastrtps::rtps::InstanceHandle_t& handle); + const fastdds::rtps::InstanceHandle_t& handle); /** * Instead of reserving a block of memory of \c size in the \c payload_pool, we can redirect the call to @@ -137,7 +137,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool DDSPIPE_CORE_DllAPI virtual bool get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; /** * @brief redirect the call to the \c release_payload in the \c payload_pool. @@ -151,8 +151,8 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool */ DDSPIPE_CORE_DllAPI virtual bool get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) override; + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& target_payload) override; /** * @brief redirect the call to the \c release_payload in the \c payload_pool. @@ -163,7 +163,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool */ DDSPIPE_CORE_DllAPI virtual bool release_payload( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) override; + eprosima::fastdds::rtps::SerializedPayload_t& payload) override; protected: @@ -171,7 +171,7 @@ class PayloadPoolMediator : public fastrtps::rtps::IPayloadPool std::mutex mutex_; //! A pointer to the payload_ we want to write down in the PayloadPool. - eprosima::fastrtps::rtps::SerializedPayload_t* payload_; + eprosima::fastdds::rtps::SerializedPayload_t* payload_; //! The \c PayloadPool the \c PayloadPoolMediator is mediating for. const std::shared_ptr& payload_pool_; diff --git a/ddspipe_core/include/ddspipe_core/interface/IReader.hpp b/ddspipe_core/include/ddspipe_core/interface/IReader.hpp index 7ab3023c..9bf2a359 100644 --- a/ddspipe_core/include/ddspipe_core/interface/IReader.hpp +++ b/ddspipe_core/include/ddspipe_core/interface/IReader.hpp @@ -121,7 +121,7 @@ class IReader //! Get internal RTPS reader mutex DDSPIPE_CORE_DllAPI - virtual fastrtps::RecursiveTimedMutex& get_rtps_mutex() const = 0; + virtual fastdds::RecursiveTimedMutex& get_rtps_mutex() const = 0; //! Get number of unread cache changes in internal RTPS reader DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp b/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp index ed5777f1..3f385577 100644 --- a/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp +++ b/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp @@ -45,13 +45,13 @@ struct RpcPayloadData : public RtpsPayloadData virtual types::TopicInternalTypeDiscriminator internal_type_discriminator() const noexcept override; //! Write params associated to the received cache change - utils::Fuzzy write_params{}; + utils::Fuzzy write_params{}; //! Sequence number of the received cache change - eprosima::fastrtps::rtps::SequenceNumber_t origin_sequence_number{}; + eprosima::fastdds::rtps::SequenceNumber_t origin_sequence_number{}; //! Sequence Number with which the internal writer (ddspipe rpc writer) has sent this message - eprosima::fastrtps::rtps::SequenceNumber_t sent_sequence_number; + eprosima::fastdds::rtps::SequenceNumber_t sent_sequence_number; }; /** diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp index a960ee8d..287ecef5 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp @@ -25,12 +25,12 @@ namespace core { namespace types { //! Unique Id of every Endpoint -class Guid : public fastrtps::rtps::GUID_t +class Guid : public fastdds::rtps::GUID_t { public: //! Using parent constructors - using fastrtps::rtps::GUID_t::GUID_t; + using fastdds::rtps::GUID_t::GUID_t; //! Default constructor DDSPIPE_CORE_DllAPI @@ -44,17 +44,17 @@ class Guid : public fastrtps::rtps::GUID_t //! Copy constructor DDSPIPE_CORE_DllAPI Guid( - const fastrtps::rtps::GUID_t& x); + const fastdds::rtps::GUID_t& x); //! Move constructor DDSPIPE_CORE_DllAPI Guid( - fastrtps::rtps::GUID_t&& x); + fastdds::rtps::GUID_t&& x); //! Equal operator (inherited from GUID_t) DDSPIPE_CORE_DllAPI Guid& operator = ( - const fastrtps::rtps::GUID_t& other) noexcept; + const fastdds::rtps::GUID_t& other) noexcept; /** * Whether the guid is a valid one diff --git a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp index b9dc4c3b..aa7444cb 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp @@ -30,12 +30,12 @@ namespace types { * This class extends the \c GuidPrefix_t class in FastDDS, which is a RTPS Participant Unique Id. * This class does not belong to class \c Guid due to a design flaw in OOP (parallel hierarchy is the future). */ -class GuidPrefix : public fastrtps::rtps::GuidPrefix_t +class GuidPrefix : public fastdds::rtps::GuidPrefix_t { public: //! Using parent constructors - using fastrtps::rtps::GuidPrefix_t::GuidPrefix_t; + using fastdds::rtps::GuidPrefix_t::GuidPrefix_t; //! Constructor from Parent class DDSPIPE_CORE_DllAPI @@ -95,7 +95,7 @@ class GuidPrefix : public fastrtps::rtps::GuidPrefix_t DDSPIPE_CORE_DllAPI GuidPrefix& operator = ( - const fastrtps::rtps::GuidPrefix_t& other) noexcept; + const fastdds::rtps::GuidPrefix_t& other) noexcept; /** * Whether the guid prefix is a valid one diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp index 6ff5904e..917d7918 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp @@ -38,19 +38,19 @@ using PartitionQosPolicy = eprosima::fastdds::dds::PartitionQosPolicy; using OwnershipStrengthQosPolicy = eprosima::fastdds::dds::OwnershipStrengthQosPolicy; //! Instance Handler type -using InstanceHandle = eprosima::fastrtps::rtps::InstanceHandle_t; +using InstanceHandle = eprosima::fastdds::rtps::InstanceHandle_t; //! Instance Handler type -using ChangeKind = eprosima::fastrtps::rtps::ChangeKind_t; +using ChangeKind = eprosima::fastdds::rtps::ChangeKind_t; //! Fast DDS Time -using DataTime = eprosima::fastrtps::rtps::Time_t; +using DataTime = eprosima::fastdds::rtps::Time_t; //! Kind of every unit that creates a Payload -using PayloadUnit = eprosima::fastrtps::rtps::octet; +using PayloadUnit = eprosima::fastdds::rtps::octet; //! Payload references the raw data received. -using Payload = eprosima::fastrtps::rtps::SerializedPayload_t; +using Payload = eprosima::fastdds::rtps::SerializedPayload_t; //! \c octet to stream serializator DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp index 899212a7..bc28f59c 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp @@ -27,10 +27,10 @@ namespace core { namespace types { //! Durability kind enumeration -using DurabilityKind = eprosima::fastrtps::rtps::DurabilityKind_t; +using DurabilityKind = eprosima::fastdds::rtps::DurabilityKind_t; //! Reliability kind enumeration -using ReliabilityKind = eprosima::fastrtps::rtps::ReliabilityKind_t; +using ReliabilityKind = eprosima::fastdds::rtps::ReliabilityKind_t; //! History kind enumeration using HistoryDepthType = unsigned int; diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp index 9979ea7f..d94694e8 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp @@ -59,7 +59,7 @@ const int32_t TOPIC_MISMATCH_QOS = 0x10000003; * @brief This class represents the enumeration Kind defined by the user in the IDL file. * @ingroup LogEntry */ -enum class Kind : uint32_t +enum class Kind : int32_t { Info, Warning, diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h index 26fa1041..7400674b 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h @@ -53,34 +53,34 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~LogEntryPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h index 86014bed..6e7b6f06 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h @@ -53,34 +53,34 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport ~MonitoringErrorStatusPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -144,34 +144,34 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~MonitoringStatusPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h index 0a4b1aca..eb28460c 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h @@ -53,34 +53,34 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~DdsTopicDataPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -144,34 +144,34 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~DdsTopicPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -235,34 +235,34 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~MonitoringTopicsPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp index 3ef07b2e..5d991d9e 100644 --- a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp +++ b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp @@ -271,7 +271,7 @@ void RpcBridge::transmit_( while (true) { { - std::lock_guard lock(reader->get_rtps_mutex()); + std::lock_guard lock(reader->get_rtps_mutex()); if (!enabled_ || !(reader->get_unread_count() > 0)) { @@ -359,7 +359,7 @@ void RpcBridge::transmit_( continue; } - eprosima::fastrtps::rtps::SequenceNumber_t sequence_number = + eprosima::fastdds::rtps::SequenceNumber_t sequence_number = rpc_data.sent_sequence_number; // Add entry to registry associated to the transmission of this request through this proxy client. service_registry.second->add( diff --git a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp index e3d91c5d..b8052035 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp @@ -28,7 +28,7 @@ using namespace eprosima::ddspipe::core::types; bool CopyPayloadPool::get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { reserve_(size, payload); payload.max_size = size; @@ -38,8 +38,8 @@ bool CopyPayloadPool::get_payload( } bool CopyPayloadPool::get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& target_payload) { if (!get_payload(src_payload.max_size, target_payload)) { diff --git a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp index 56a7cae5..65b1cad1 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp @@ -31,15 +31,15 @@ using namespace eprosima::ddspipe::core::types; bool FastPayloadPool::get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { // Reserve new payload return reserve_(size, payload); } bool FastPayloadPool::get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& target_payload) { // If we are not the owner, create a new payload. Else, reference the existing one if (src_payload.payload_owner != this) @@ -55,6 +55,7 @@ bool FastPayloadPool::get_payload( // Copy info std::memcpy(target_payload.data, src_payload.data, src_payload.length); target_payload.length = src_payload.length; + target_payload.payload_owner = this; } else { @@ -108,7 +109,7 @@ bool FastPayloadPool::release_payload( bool FastPayloadPool::reserve_( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { if (size == 0) { @@ -124,7 +125,7 @@ bool FastPayloadPool::reserve_( MetaInfoType* reference_place = reinterpret_cast(memory_allocated); (*reference_place) = 1; - payload.data = reinterpret_cast(reference_place + 1); + payload.data = reinterpret_cast(reference_place + 1); payload.max_size = size; payload.payload_owner = this; @@ -136,7 +137,7 @@ bool FastPayloadPool::reserve_( } bool FastPayloadPool::release_( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { logDebug(DDSPIPE_PAYLOADPOOL_FAST, "Releasing payload ptr: " << static_cast(payload.data) << "."); diff --git a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp index 1ae76aef..78c75c8c 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp @@ -43,7 +43,7 @@ MapPayloadPool::~MapPayloadPool() bool MapPayloadPool::get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { // Reserve new payload if (!reserve_(size, payload)) @@ -61,8 +61,8 @@ bool MapPayloadPool::get_payload( } bool MapPayloadPool::get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& target_payload) { // If we are not the owner, create a new payload. Else, reference the existing one if (src_payload.payload_owner != this) @@ -102,7 +102,7 @@ bool MapPayloadPool::get_payload( } bool MapPayloadPool::release_payload( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { std::lock_guard lock(reserved_payloads_mutex_); diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index 2debec23..4e6d7709 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -57,7 +57,7 @@ PayloadPool::~PayloadPool() // bool PayloadPool::get_payload( // uint32_t size, -// eprosima::fastrtps::rtps::CacheChange_t& cache_change) +// eprosima::fastdds::rtps::CacheChange_t& cache_change) // { // if (get_payload(size, cache_change.serializedPayload)) // { @@ -72,9 +72,9 @@ PayloadPool::~PayloadPool() // } // bool PayloadPool::get_payload( -// fastrtps::rtps::SerializedPayload_t& data, +// fastdds::rtps::SerializedPayload_t& data, // IPayloadPool*& data_owner, -// eprosima::fastrtps::rtps::CacheChange_t& cache_change) +// eprosima::fastdds::rtps::CacheChange_t& cache_change) // { // if (get_payload(data, data_owner, cache_change.serializedPayload)) // { @@ -89,7 +89,7 @@ PayloadPool::~PayloadPool() // } // bool PayloadPool::release_payload( -// fastrtps::rtps::CacheChange_t& cache_change) +// fastdds::rtps::CacheChange_t& cache_change) // { // if (cache_change.payload_owner() == this) // { @@ -137,7 +137,7 @@ void PayloadPool::add_release_payload_() bool PayloadPool::reserve_( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { if (size == 0) { @@ -156,7 +156,7 @@ bool PayloadPool::reserve_( } bool PayloadPool::release_( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { logDebug(DDSPIPE_PAYLOADPOOL, "Releasing payload ptr: " << payload.data << "."); diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp index 532e8b14..e691e56c 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp @@ -48,7 +48,7 @@ bool PayloadPoolMediator::write( bool PayloadPoolMediator::write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, - fastrtps::rtps::WriteParams& params) + fastdds::rtps::WriteParams& params) { // Lock the mutex_ to ensure that the payload hasn't changed when we retrieve it in get_payload. std::lock_guard lock(mutex_); @@ -61,7 +61,7 @@ bool PayloadPoolMediator::write( fastdds::dds::ReturnCode_t PayloadPoolMediator::write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, - const fastrtps::rtps::InstanceHandle_t& handle) + const fastdds::rtps::InstanceHandle_t& handle) { // Lock the mutex_ to ensure that the payload hasn't changed when we retrieve it in get_payload. std::lock_guard lock(mutex_); @@ -73,20 +73,20 @@ fastdds::dds::ReturnCode_t PayloadPoolMediator::write( bool PayloadPoolMediator::get_payload( uint32_t size, - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { return get_payload(*payload_, payload); } bool PayloadPoolMediator::get_payload( - const eprosima::fastrtps::rtps::SerializedPayload_t& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& target_payload) + const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, + eprosima::fastdds::rtps::SerializedPayload_t& target_payload) { return payload_pool_->get_payload(src_payload, target_payload); } bool PayloadPoolMediator::release_payload( - eprosima::fastrtps::rtps::SerializedPayload_t& payload) + eprosima::fastdds::rtps::SerializedPayload_t& payload) { return payload_pool_->release_payload(payload); } diff --git a/ddspipe_core/src/cpp/testing/random_values.cpp b/ddspipe_core/src/cpp/testing/random_values.cpp index 4fb8d4b5..5e083c3e 100644 --- a/ddspipe_core/src/cpp/testing/random_values.cpp +++ b/ddspipe_core/src/cpp/testing/random_values.cpp @@ -25,7 +25,7 @@ Guid random_guid( unsigned int seed /* = 1 */) { Guid guid; - guid.entityId.value[3] = static_cast(seed); + guid.entityId.value[3] = static_cast(seed); guid.guidPrefix.value[0] = 0x01; guid.guidPrefix.value[1] = 0x0f; return guid; diff --git a/ddspipe_core/src/cpp/types/dds/Guid.cpp b/ddspipe_core/src/cpp/types/dds/Guid.cpp index 022b6db2..da1a4aa5 100644 --- a/ddspipe_core/src/cpp/types/dds/Guid.cpp +++ b/ddspipe_core/src/cpp/types/dds/Guid.cpp @@ -29,21 +29,21 @@ Guid::Guid( } Guid::Guid( - const fastrtps::rtps::GUID_t& x) + const fastdds::rtps::GUID_t& x) { guidPrefix = x.guidPrefix; entityId = x.entityId; } Guid::Guid( - fastrtps::rtps::GUID_t&& x) + fastdds::rtps::GUID_t&& x) { guidPrefix = std::move(x.guidPrefix); entityId = std::move(x.entityId); } Guid& Guid::operator = ( - const fastrtps::rtps::GUID_t& other) noexcept + const fastdds::rtps::GUID_t& other) noexcept { this->guidPrefix = other.guidPrefix; this->entityId = other.entityId; @@ -53,7 +53,7 @@ Guid& Guid::operator = ( bool Guid::is_valid() const noexcept { return guid_prefix().is_valid() && - entityId != eprosima::fastrtps::rtps::EntityId_t::unknown(); + entityId != eprosima::fastdds::rtps::EntityId_t::unknown(); } GuidPrefix Guid::guid_prefix() const noexcept @@ -69,7 +69,7 @@ Guid Guid::new_unique_guid() Guid new_guid; unsigned int numer = ++current_unique_value; unsigned int denom = 256; - for (unsigned int i = 0; i < fastrtps::rtps::EntityId_t::size; i++) + for (unsigned int i = 0; i < fastdds::rtps::EntityId_t::size; i++) { new_guid.entityId.value[i] = numer % denom; numer = static_cast(std::floor(numer / denom)); diff --git a/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp b/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp index 3e329652..56fbaa12 100644 --- a/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp +++ b/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp @@ -57,7 +57,7 @@ GuidPrefix::GuidPrefix ( // Modify depending on the seed // TODO : make available to modify for the whole guid prefix, so it is not truncated to 255 - value[2] = static_cast(id); + value[2] = static_cast(id); } GuidPrefix::GuidPrefix ( @@ -67,7 +67,7 @@ GuidPrefix::GuidPrefix ( } GuidPrefix& GuidPrefix::operator = ( - const fastrtps::rtps::GuidPrefix_t& other) noexcept + const fastdds::rtps::GuidPrefix_t& other) noexcept { for (unsigned int i = 0; i < this->size; ++i) { @@ -78,7 +78,7 @@ GuidPrefix& GuidPrefix::operator = ( bool GuidPrefix::is_valid() const noexcept { - return *this != eprosima::fastrtps::rtps::GuidPrefix_t::unknown(); + return *this != eprosima::fastdds::rtps::GuidPrefix_t::unknown(); } } /* namespace types */ diff --git a/ddspipe_core/src/cpp/types/dds/Payload.cpp b/ddspipe_core/src/cpp/types/dds/Payload.cpp index 8633ea16..aa208859 100644 --- a/ddspipe_core/src/cpp/types/dds/Payload.cpp +++ b/ddspipe_core/src/cpp/types/dds/Payload.cpp @@ -23,7 +23,7 @@ namespace types { std::ostream& operator <<( std::ostream& os, - const eprosima::fastrtps::rtps::octet& octet) + const eprosima::fastdds::rtps::octet& octet) { os << std::hex << std::setfill('0') << std::setw(2) << static_cast(octet) << std::dec; return os; diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx index b1a5c9d5..126f5428 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx @@ -27,8 +27,8 @@ #include #include -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; LogEntryPubSubType::LogEntryPubSubType() @@ -57,11 +57,11 @@ LogEntryPubSubType::~LogEntryPubSubType() } bool LogEntryPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - LogEntry* p_type = static_cast(data); + const LogEntry* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool LogEntryPubSubType::deserialize( } std::function LogEntryPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function LogEntryPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void LogEntryPubSubType::deleteData( } bool LogEntryPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool LogEntryPubSubType::getKey( return false; } - LogEntry* p_type = static_cast(data); + const LogEntry* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx index 608e0dde..1233bb03 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx @@ -27,8 +27,8 @@ #include #include -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; MonitoringErrorStatusPubSubType::MonitoringErrorStatusPubSubType() @@ -57,11 +57,11 @@ MonitoringErrorStatusPubSubType::~MonitoringErrorStatusPubSubType() } bool MonitoringErrorStatusPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - MonitoringErrorStatus* p_type = static_cast(data); + const MonitoringErrorStatus* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool MonitoringErrorStatusPubSubType::deserialize( } std::function MonitoringErrorStatusPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function MonitoringErrorStatusPubSubType::getSerializedSizeProv 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void MonitoringErrorStatusPubSubType::deleteData( } bool MonitoringErrorStatusPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool MonitoringErrorStatusPubSubType::getKey( return false; } - MonitoringErrorStatus* p_type = static_cast(data); + const MonitoringErrorStatus* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -250,11 +250,11 @@ MonitoringStatusPubSubType::~MonitoringStatusPubSubType() } bool MonitoringStatusPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - MonitoringStatus* p_type = static_cast(data); + const MonitoringStatus* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -326,7 +326,7 @@ bool MonitoringStatusPubSubType::deserialize( } std::function MonitoringStatusPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -343,7 +343,7 @@ std::function MonitoringStatusPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -366,7 +366,7 @@ void MonitoringStatusPubSubType::deleteData( } bool MonitoringStatusPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -375,7 +375,7 @@ bool MonitoringStatusPubSubType::getKey( return false; } - MonitoringStatus* p_type = static_cast(data); + const MonitoringStatus* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx index d545020d..8adc0a99 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx @@ -27,8 +27,8 @@ #include #include -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; DdsTopicDataPubSubType::DdsTopicDataPubSubType() @@ -57,11 +57,11 @@ DdsTopicDataPubSubType::~DdsTopicDataPubSubType() } bool DdsTopicDataPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - DdsTopicData* p_type = static_cast(data); + const DdsTopicData* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool DdsTopicDataPubSubType::deserialize( } std::function DdsTopicDataPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function DdsTopicDataPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void DdsTopicDataPubSubType::deleteData( } bool DdsTopicDataPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool DdsTopicDataPubSubType::getKey( return false; } - DdsTopicData* p_type = static_cast(data); + const DdsTopicData* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -250,11 +250,11 @@ DdsTopicPubSubType::~DdsTopicPubSubType() } bool DdsTopicPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - DdsTopic* p_type = static_cast(data); + const DdsTopic* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -326,7 +326,7 @@ bool DdsTopicPubSubType::deserialize( } std::function DdsTopicPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -343,7 +343,7 @@ std::function DdsTopicPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -366,7 +366,7 @@ void DdsTopicPubSubType::deleteData( } bool DdsTopicPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -375,7 +375,7 @@ bool DdsTopicPubSubType::getKey( return false; } - DdsTopic* p_type = static_cast(data); + const DdsTopic* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -443,11 +443,11 @@ MonitoringTopicsPubSubType::~MonitoringTopicsPubSubType() } bool MonitoringTopicsPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - MonitoringTopics* p_type = static_cast(data); + const MonitoringTopics* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -519,7 +519,7 @@ bool MonitoringTopicsPubSubType::deserialize( } std::function MonitoringTopicsPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -536,7 +536,7 @@ std::function MonitoringTopicsPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -559,7 +559,7 @@ void MonitoringTopicsPubSubType::deleteData( } bool MonitoringTopicsPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -568,7 +568,7 @@ bool MonitoringTopicsPubSubType::getKey( return false; } - MonitoringTopics* p_type = static_cast(data); + const MonitoringTopics* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp index c0a1092f..ab5f5c88 100644 --- a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp @@ -67,8 +67,8 @@ void get_release( FastPayloadPool& pool, Payload& src_payload) { - eprosima::fastrtps::rtps::IPayloadPool* payload_owner = - static_cast(&pool); + eprosima::fastdds::rtps::IPayloadPool* payload_owner = + static_cast(&pool); Payload dst_payload; ASSERT_TRUE(pool.get_payload(src_payload, dst_payload)); ASSERT_TRUE(pool.release_payload(dst_payload)); @@ -140,7 +140,7 @@ TEST(FastPayloadPoolTest, get_payload) */ TEST(FastPayloadPoolTest, get_payload_from_src) { - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockFastPayloadPool* pool_ = static_cast(pool); Payload payload0; @@ -213,9 +213,9 @@ TEST(FastPayloadPoolTest, get_payload_from_src_no_owner) { // Each pool has a IPayloadPool and a MockFastPayloadPool so it can be called to get_payload from source // and specific methods from mock - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockFastPayloadPool* pool_ = static_cast(pool); - eprosima::fastrtps::rtps::IPayloadPool* pool_aux = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool_aux = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockFastPayloadPool* pool_aux_ = static_cast(pool_aux); Payload payload_src; @@ -253,9 +253,9 @@ TEST(FastPayloadPoolTest, get_payload_from_src_negative) { // Source has size 0 and different owner { - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockFastPayloadPool* pool_ = static_cast(pool); - eprosima::fastrtps::rtps::IPayloadPool* pool_aux = nullptr; // nullptr + eprosima::fastdds::rtps::IPayloadPool* pool_aux = nullptr; // nullptr Payload payload_src; Payload payload_target; @@ -281,7 +281,7 @@ TEST(FastPayloadPoolTest, get_payload_from_src_negative) */ TEST(FastPayloadPoolTest, release_payload) { - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockFastPayloadPool* pool_ = static_cast(pool); std::vector payloads(TEST_NUMBER); @@ -393,8 +393,8 @@ TEST(FastPayloadPoolTest, concurrent_release) ASSERT_TRUE(pool.get_payload(DEFAULT_SIZE, payload)); - eprosima::fastrtps::rtps::IPayloadPool* payload_owner = - static_cast(&pool); + eprosima::fastdds::rtps::IPayloadPool* payload_owner = + static_cast(&pool); Payload dst_payload; ASSERT_TRUE(pool.get_payload(payload, dst_payload)); diff --git a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp index 6e027b9f..244e2be3 100644 --- a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp @@ -51,15 +51,15 @@ class MockMapPayloadPool : public MapPayloadPool } uint64_t reference_count( - const eprosima::fastrtps::rtps::SerializedPayload_t& payload) + const eprosima::fastdds::rtps::SerializedPayload_t& payload) { return reserved_payloads_[payload.data]; } void clean_all( - std::vector& payloads) + std::vector& payloads) { - for (eprosima::fastrtps::rtps::SerializedPayload_t& payload : payloads) + for (eprosima::fastdds::rtps::SerializedPayload_t& payload : payloads) { release_payload(payload); } @@ -88,7 +88,7 @@ TEST(MapPayloadPoolTest, get_payload) // Get N different pointers { test::MockMapPayloadPool pool; - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); for (unsigned int i = 0; i < TEST_NUMBER; i++) { @@ -106,7 +106,7 @@ TEST(MapPayloadPoolTest, get_payload) // fail reserve memory { test::MockMapPayloadPool pool; - eprosima::fastrtps::rtps::SerializedPayload_t payload; + eprosima::fastdds::rtps::SerializedPayload_t payload; ASSERT_FALSE(pool.get_payload(0, payload)); } @@ -127,15 +127,15 @@ TEST(MapPayloadPoolTest, get_payload) */ TEST(MapPayloadPoolTest, get_payload_from_src) { - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - eprosima::fastrtps::rtps::SerializedPayload_t payload0; - eprosima::fastrtps::rtps::SerializedPayload_t payload1; - eprosima::fastrtps::rtps::SerializedPayload_t payload2; - eprosima::fastrtps::rtps::SerializedPayload_t payload3; - eprosima::fastrtps::rtps::SerializedPayload_t payload4; - eprosima::fastrtps::rtps::SerializedPayload_t payload5; + eprosima::fastdds::rtps::SerializedPayload_t payload0; + eprosima::fastdds::rtps::SerializedPayload_t payload1; + eprosima::fastdds::rtps::SerializedPayload_t payload2; + eprosima::fastdds::rtps::SerializedPayload_t payload3; + eprosima::fastdds::rtps::SerializedPayload_t payload4; + eprosima::fastdds::rtps::SerializedPayload_t payload5; // get payload0 ASSERT_TRUE(pool_->get_payload(DEFAULT_SIZE, payload0)); @@ -209,13 +209,13 @@ TEST(MapPayloadPoolTest, get_payload_from_src_no_owner) { // Each pool has a IPayloadPool and a MockMapPayloadPool so it can be called to get_payload from source // and specific methods from mock - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - eprosima::fastrtps::rtps::IPayloadPool* pool_aux = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool_aux = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_aux_ = static_cast(pool_aux); - eprosima::fastrtps::rtps::SerializedPayload_t payload_src; - eprosima::fastrtps::rtps::SerializedPayload_t payload_target; + eprosima::fastdds::rtps::SerializedPayload_t payload_src; + eprosima::fastdds::rtps::SerializedPayload_t payload_target; // get payload aux from pool aux pool_aux_->get_payload(DEFAULT_SIZE, payload_src); @@ -249,12 +249,12 @@ TEST(MapPayloadPoolTest, get_payload_from_src_negative) { // Source has size 0 and different owner { - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - eprosima::fastrtps::rtps::IPayloadPool* pool_aux = nullptr; // nullptr + eprosima::fastdds::rtps::IPayloadPool* pool_aux = nullptr; // nullptr - eprosima::fastrtps::rtps::SerializedPayload_t payload_src; - eprosima::fastrtps::rtps::SerializedPayload_t payload_target; + eprosima::fastdds::rtps::SerializedPayload_t payload_src; + eprosima::fastdds::rtps::SerializedPayload_t payload_target; ASSERT_FALSE( pool_->get_payload( @@ -277,9 +277,9 @@ TEST(MapPayloadPoolTest, get_payload_from_src_negative) */ TEST(MapPayloadPoolTest, release_payload) { - eprosima::fastrtps::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); // get first payload pool_->get_payload(DEFAULT_SIZE, payloads[0]); @@ -332,7 +332,7 @@ TEST(MapPayloadPoolTest, release_payload_negative) test::MockMapPayloadPool pool; test::MockMapPayloadPool pool_aux; - eprosima::fastrtps::rtps::SerializedPayload_t payload; + eprosima::fastdds::rtps::SerializedPayload_t payload; pool_aux.get_payload(DEFAULT_SIZE, payload); diff --git a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp index 77811952..74da3f62 100644 --- a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp @@ -35,14 +35,14 @@ using ::testing::Invoke; using ::testing::Return; namespace eprosima { -namespace fastrtps { +namespace fastdds { namespace rtps { /* * WORKAROUND: * This definition is needed due to googletest-distribution (1.11.0) requires to every class used inside ASSERT macro * to have the operator << defined in SAME namespace than the class. - * In our case, Payload is defined as eprosima::fastrtps::rtps::SerializedPayload_t but redefined as + * In our case, Payload is defined as eprosima::fastdds::rtps::SerializedPayload_t but redefined as * eprosima::ddspipe::core::types::Payload and the operator << is defined in eprosima::ddspipe::core::types * Thus, gtest could not find this definition (arising a very messy and cryptic compilation error). * This definition corrects that problem. @@ -54,11 +54,11 @@ void PrintTo( const SerializedPayload_t&, std::ostream* os) { - *os << "::eprosima::fastrtps::rtps::SerializedPayload_t"; + *os << "::eprosima::fastdds::rtps::SerializedPayload_t"; } } /* namespace rtps */ -} /* namespace fastrtps */ +} /* namespace fastdds */ } /* namespace eprosima */ namespace eprosima { @@ -88,7 +88,7 @@ class MockPayloadPool : public PayloadPool MOCK_METHOD( bool, get_payload, - (uint32_t size, eprosima::fastrtps::rtps::SerializedPayload_t& target_payload), + (uint32_t size, eprosima::fastdds::rtps::SerializedPayload_t& target_payload), (override)); MOCK_METHOD( @@ -96,14 +96,14 @@ class MockPayloadPool : public PayloadPool get_payload, ( const Payload& src_payload, - eprosima::fastrtps::rtps::SerializedPayload_t& target_payload + eprosima::fastdds::rtps::SerializedPayload_t& target_payload ), (override)); MOCK_METHOD( bool, release_payload, - (eprosima::fastrtps::rtps::SerializedPayload_t& target_payload), + (eprosima::fastdds::rtps::SerializedPayload_t& target_payload), (override)); }; @@ -319,7 +319,7 @@ TEST(PayloadPoolTest, is_clean) ASSERT_TRUE(pool.is_clean()); // reserve and not clean - eprosima::fastrtps::rtps::CacheChange_t cc; + eprosima::fastdds::rtps::CacheChange_t cc; pool.reserve_(sizeof(PayloadUnit), cc.serializedPayload); ASSERT_FALSE(pool.is_clean()); @@ -340,7 +340,7 @@ TEST(PayloadPoolTest, is_clean) // // get_payload for payload goes ok // { // test::MockPayloadPool pool; -// eprosima::fastrtps::rtps::CacheChange_t cc; +// eprosima::fastdds::rtps::CacheChange_t cc; // EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(true)); @@ -353,7 +353,7 @@ TEST(PayloadPoolTest, is_clean) // // get_payload for payload goes ok // { // test::MockPayloadPool pool; -// eprosima::fastrtps::rtps::CacheChange_t cc; +// eprosima::fastdds::rtps::CacheChange_t cc; // EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(false)); @@ -373,9 +373,9 @@ TEST(PayloadPoolTest, is_clean) // // get_payload for payload goes ok // { // test::MockPayloadPool pool; -// eprosima::fastrtps::rtps::CacheChange_t target; +// eprosima::fastdds::rtps::CacheChange_t target; // Payload source; -// eprosima::fastrtps::rtps::IPayloadPool* aux_pool; +// eprosima::fastdds::rtps::IPayloadPool* aux_pool; // EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(true)); @@ -397,9 +397,9 @@ TEST(PayloadPoolTest, is_clean) // // get_payload for payload fails // { // test::MockPayloadPool pool; -// eprosima::fastrtps::rtps::CacheChange_t target; +// eprosima::fastdds::rtps::CacheChange_t target; // Payload source; -// eprosima::fastrtps::rtps::IPayloadPool* aux_pool; +// eprosima::fastdds::rtps::IPayloadPool* aux_pool; // EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(false)); @@ -419,7 +419,7 @@ TEST(PayloadPoolTest, is_clean) // // this ownership release ok // { // test::MockPayloadPool pool; -// eprosima::fastrtps::rtps::CacheChange_t cc; +// eprosima::fastdds::rtps::CacheChange_t cc; // // ownership must be this pool // cc.payload_owner(&pool); @@ -444,7 +444,7 @@ TEST(PayloadPoolTest, is_clean) // INSTANTIATE_LOG_TESTER(eprosima::utils::Log::Kind::Error, 1, 1); // test::MockPayloadPool pool; -// eprosima::fastrtps::rtps::CacheChange_t cc; +// eprosima::fastdds::rtps::CacheChange_t cc; // cc.payload_owner(nullptr); // EXPECT_THROW(pool.release_payload(cc), eprosima::utils::InconsistencyException); @@ -453,7 +453,7 @@ TEST(PayloadPoolTest, is_clean) // // this ownership release fail // { // test::MockPayloadPool pool; -// eprosima::fastrtps::rtps::CacheChange_t cc; +// eprosima::fastdds::rtps::CacheChange_t cc; // // ownership must be this pool // cc.payload_owner(&pool); diff --git a/ddspipe_core/test/unittest/logging/constants.hpp b/ddspipe_core/test/unittest/logging/constants.hpp index 76b92afd..8ac96741 100644 --- a/ddspipe_core/test/unittest/logging/constants.hpp +++ b/ddspipe_core/test/unittest/logging/constants.hpp @@ -33,7 +33,7 @@ using namespace eprosima; using namespace eprosima::ddspipe::core::types; // Maximum time to wait for a sample to arrive. -const auto MAX_WAITING_TIME = fastrtps::Duration_t(1); +const auto MAX_WAITING_TIME = fastdds::Duration_t(1); // The domain and topic the Monitor should publish its data in. constexpr DomainIdType DOMAIN = 84; diff --git a/ddspipe_core/test/unittest/monitoring/constants.hpp b/ddspipe_core/test/unittest/monitoring/constants.hpp index e759fb4f..d8658a55 100644 --- a/ddspipe_core/test/unittest/monitoring/constants.hpp +++ b/ddspipe_core/test/unittest/monitoring/constants.hpp @@ -37,7 +37,7 @@ constexpr std::uint32_t PERIOD_MS = 500; constexpr double PERIOD_SECS = (double) PERIOD_MS / 1000; // Maximum time to wait for a sample to arrive. -const auto MAX_WAITING_TIME = fastrtps::Duration_t(PERIOD_SECS * 3); +const auto MAX_WAITING_TIME = fastdds::Duration_t(PERIOD_SECS * 3); // The domain and topic the Monitor should publish its data in. constexpr DomainIdType DOMAIN = 84; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx index 5b568927..817ea559 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "arrays_and_sequencesCdrAux.hpp" #include "arrays_and_sequencesTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; AnInternalObjectPubSubType::AnInternalObjectPubSubType() @@ -57,11 +57,11 @@ AnInternalObjectPubSubType::~AnInternalObjectPubSubType() } bool AnInternalObjectPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - AnInternalObject* p_type = static_cast(data); + const AnInternalObject* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool AnInternalObjectPubSubType::deserialize( } std::function AnInternalObjectPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function AnInternalObjectPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void AnInternalObjectPubSubType::deleteData( } bool AnInternalObjectPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool AnInternalObjectPubSubType::getKey( return false; } - AnInternalObject* p_type = static_cast(data); + const AnInternalObject* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -250,11 +250,11 @@ arrays_and_sequencesPubSubType::~arrays_and_sequencesPubSubType() } bool arrays_and_sequencesPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - arrays_and_sequences* p_type = static_cast(data); + const arrays_and_sequences* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -326,7 +326,7 @@ bool arrays_and_sequencesPubSubType::deserialize( } std::function arrays_and_sequencesPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -343,7 +343,7 @@ std::function arrays_and_sequencesPubSubType::getSerializedSizeProvi 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -366,7 +366,7 @@ void arrays_and_sequencesPubSubType::deleteData( } bool arrays_and_sequencesPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -375,7 +375,7 @@ bool arrays_and_sequencesPubSubType::getKey( return false; } - arrays_and_sequences* p_type = static_cast(data); + const arrays_and_sequences* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h index f9e19c21..4ff0381f 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h @@ -53,34 +53,34 @@ class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~AnInternalObjectPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -144,34 +144,34 @@ class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataT eProsima_user_DllExport ~arrays_and_sequencesPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx index d0517c68..52210117 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "basic_array_structCdrAux.hpp" #include "basic_array_structTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; TheOtherObjectInArrayPubSubType::TheOtherObjectInArrayPubSubType() @@ -57,11 +57,11 @@ TheOtherObjectInArrayPubSubType::~TheOtherObjectInArrayPubSubType() } bool TheOtherObjectInArrayPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - TheOtherObjectInArray* p_type = static_cast(data); + const TheOtherObjectInArray* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool TheOtherObjectInArrayPubSubType::deserialize( } std::function TheOtherObjectInArrayPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function TheOtherObjectInArrayPubSubType::getSerializedSizeProv 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void TheOtherObjectInArrayPubSubType::deleteData( } bool TheOtherObjectInArrayPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool TheOtherObjectInArrayPubSubType::getKey( return false; } - TheOtherObjectInArray* p_type = static_cast(data); + const TheOtherObjectInArray* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -250,11 +250,11 @@ basic_array_structPubSubType::~basic_array_structPubSubType() } bool basic_array_structPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - basic_array_struct* p_type = static_cast(data); + const basic_array_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -326,7 +326,7 @@ bool basic_array_structPubSubType::deserialize( } std::function basic_array_structPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -343,7 +343,7 @@ std::function basic_array_structPubSubType::getSerializedSizeProvide 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -366,7 +366,7 @@ void basic_array_structPubSubType::deleteData( } bool basic_array_structPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -375,7 +375,7 @@ bool basic_array_structPubSubType::getKey( return false; } - basic_array_struct* p_type = static_cast(data); + const basic_array_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h index 3a94f899..35dd7f7a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h @@ -53,34 +53,34 @@ class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport ~TheOtherObjectInArrayPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -144,34 +144,34 @@ class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataTyp eProsima_user_DllExport ~basic_array_structPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx index 62f7f479..e666461d 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "basic_structCdrAux.hpp" #include "basic_structTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; TheOtherObjectPubSubType::TheOtherObjectPubSubType() @@ -57,11 +57,11 @@ TheOtherObjectPubSubType::~TheOtherObjectPubSubType() } bool TheOtherObjectPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - TheOtherObject* p_type = static_cast(data); + const TheOtherObject* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool TheOtherObjectPubSubType::deserialize( } std::function TheOtherObjectPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function TheOtherObjectPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void TheOtherObjectPubSubType::deleteData( } bool TheOtherObjectPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool TheOtherObjectPubSubType::getKey( return false; } - TheOtherObject* p_type = static_cast(data); + const TheOtherObject* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -250,11 +250,11 @@ basic_structPubSubType::~basic_structPubSubType() } bool basic_structPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - basic_struct* p_type = static_cast(data); + const basic_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -326,7 +326,7 @@ bool basic_structPubSubType::deserialize( } std::function basic_structPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -343,7 +343,7 @@ std::function basic_structPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -366,7 +366,7 @@ void basic_structPubSubType::deleteData( } bool basic_structPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -375,7 +375,7 @@ bool basic_structPubSubType::getKey( return false; } - basic_struct* p_type = static_cast(data); + const basic_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h index 8c5d1cdd..941c4e7a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h @@ -53,34 +53,34 @@ class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~TheOtherObjectPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -144,34 +144,34 @@ class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~basic_structPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx index 32a91178..5f6f1d61 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx @@ -27,8 +27,8 @@ #include "char_sequenceCdrAux.hpp" #include "char_sequenceTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; char_sequencePubSubType::char_sequencePubSubType() @@ -57,11 +57,11 @@ char_sequencePubSubType::~char_sequencePubSubType() } bool char_sequencePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - char_sequence* p_type = static_cast(data); + const char_sequence* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool char_sequencePubSubType::deserialize( } std::function char_sequencePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function char_sequencePubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void char_sequencePubSubType::deleteData( } bool char_sequencePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool char_sequencePubSubType::getKey( return false; } - char_sequence* p_type = static_cast(data); + const char_sequence* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h index c1a04da7..acd3e497 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h @@ -53,34 +53,34 @@ class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~char_sequencePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx index db210aa1..03309374 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "complex_nested_arraysCdrAux.hpp" #include "complex_nested_arraysTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; ThirdLevelElementPubSubType::ThirdLevelElementPubSubType() @@ -57,11 +57,11 @@ ThirdLevelElementPubSubType::~ThirdLevelElementPubSubType() } bool ThirdLevelElementPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - ThirdLevelElement* p_type = static_cast(data); + const ThirdLevelElement* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool ThirdLevelElementPubSubType::deserialize( } std::function ThirdLevelElementPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function ThirdLevelElementPubSubType::getSerializedSizeProvider 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void ThirdLevelElementPubSubType::deleteData( } bool ThirdLevelElementPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool ThirdLevelElementPubSubType::getKey( return false; } - ThirdLevelElement* p_type = static_cast(data); + const ThirdLevelElement* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -250,11 +250,11 @@ SecondLevelElementPubSubType::~SecondLevelElementPubSubType() } bool SecondLevelElementPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - SecondLevelElement* p_type = static_cast(data); + const SecondLevelElement* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -326,7 +326,7 @@ bool SecondLevelElementPubSubType::deserialize( } std::function SecondLevelElementPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -343,7 +343,7 @@ std::function SecondLevelElementPubSubType::getSerializedSizeProvide 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -366,7 +366,7 @@ void SecondLevelElementPubSubType::deleteData( } bool SecondLevelElementPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -375,7 +375,7 @@ bool SecondLevelElementPubSubType::getKey( return false; } - SecondLevelElement* p_type = static_cast(data); + const SecondLevelElement* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -443,11 +443,11 @@ FirstLevelElementPubSubType::~FirstLevelElementPubSubType() } bool FirstLevelElementPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - FirstLevelElement* p_type = static_cast(data); + const FirstLevelElement* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -519,7 +519,7 @@ bool FirstLevelElementPubSubType::deserialize( } std::function FirstLevelElementPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -536,7 +536,7 @@ std::function FirstLevelElementPubSubType::getSerializedSizeProvider 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -559,7 +559,7 @@ void FirstLevelElementPubSubType::deleteData( } bool FirstLevelElementPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -568,7 +568,7 @@ bool FirstLevelElementPubSubType::getKey( return false; } - FirstLevelElement* p_type = static_cast(data); + const FirstLevelElement* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -636,11 +636,11 @@ complex_nested_arraysPubSubType::~complex_nested_arraysPubSubType() } bool complex_nested_arraysPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - complex_nested_arrays* p_type = static_cast(data); + const complex_nested_arrays* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -712,7 +712,7 @@ bool complex_nested_arraysPubSubType::deserialize( } std::function complex_nested_arraysPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -729,7 +729,7 @@ std::function complex_nested_arraysPubSubType::getSerializedSizeProv 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -752,7 +752,7 @@ void complex_nested_arraysPubSubType::deleteData( } bool complex_nested_arraysPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -761,7 +761,7 @@ bool complex_nested_arraysPubSubType::getKey( return false; } - complex_nested_arrays* p_type = static_cast(data); + const complex_nested_arrays* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h index 119b0206..74a5eea3 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h @@ -53,34 +53,34 @@ class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~ThirdLevelElementPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -144,34 +144,34 @@ class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataTyp eProsima_user_DllExport ~SecondLevelElementPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -235,34 +235,34 @@ class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~FirstLevelElementPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; @@ -326,34 +326,34 @@ class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport ~complex_nested_arraysPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp index 233d3ec4..db561935 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp @@ -53,7 +53,7 @@ * @brief This class represents the enumeration ColorEnum defined by the user in the IDL file. * @ingroup enum_struct */ -enum class ColorEnum : uint32_t +enum class ColorEnum : int32_t { RED, GREEN, diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx index 507c74a2..497c3a96 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "enum_structCdrAux.hpp" #include "enum_structTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; enum_structPubSubType::enum_structPubSubType() @@ -57,11 +57,11 @@ enum_structPubSubType::~enum_structPubSubType() } bool enum_structPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - enum_struct* p_type = static_cast(data); + const enum_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool enum_structPubSubType::deserialize( } std::function enum_structPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function enum_structPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void enum_structPubSubType::deleteData( } bool enum_structPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool enum_structPubSubType::getKey( return false; } - enum_struct* p_type = static_cast(data); + const enum_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h index dfade420..fee1678d 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h @@ -53,34 +53,34 @@ class enum_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~enum_structPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx index 09d0d203..230b2cb0 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx @@ -27,8 +27,8 @@ #include "float_bounded_sequenceCdrAux.hpp" #include "float_bounded_sequenceTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; float_bounded_sequencePubSubType::float_bounded_sequencePubSubType() @@ -57,11 +57,11 @@ float_bounded_sequencePubSubType::~float_bounded_sequencePubSubType() } bool float_bounded_sequencePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - float_bounded_sequence* p_type = static_cast(data); + const float_bounded_sequence* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool float_bounded_sequencePubSubType::deserialize( } std::function float_bounded_sequencePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function float_bounded_sequencePubSubType::getSerializedSizePro 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void float_bounded_sequencePubSubType::deleteData( } bool float_bounded_sequencePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool float_bounded_sequencePubSubType::getKey( return false; } - float_bounded_sequence* p_type = static_cast(data); + const float_bounded_sequence* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h index 2764b766..1b2cbb5b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h @@ -53,34 +53,34 @@ class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDat eProsima_user_DllExport ~float_bounded_sequencePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx index 92cef86b..20d36fe0 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "hello_worldCdrAux.hpp" #include "hello_worldTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; hello_worldPubSubType::hello_worldPubSubType() @@ -57,11 +57,11 @@ hello_worldPubSubType::~hello_worldPubSubType() } bool hello_worldPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - hello_world* p_type = static_cast(data); + const hello_world* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool hello_worldPubSubType::deserialize( } std::function hello_worldPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function hello_worldPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void hello_worldPubSubType::deleteData( } bool hello_worldPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool hello_worldPubSubType::getKey( return false; } - hello_world* p_type = static_cast(data); + const hello_world* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h index dc1b82f2..faf7f1f1 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h @@ -53,34 +53,34 @@ class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~hello_worldPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx index ba09f468..f1f4135e 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "map_structCdrAux.hpp" #include "map_structTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; map_structPubSubType::map_structPubSubType() @@ -57,11 +57,11 @@ map_structPubSubType::~map_structPubSubType() } bool map_structPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - map_struct* p_type = static_cast(data); + const map_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool map_structPubSubType::deserialize( } std::function map_structPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function map_structPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void map_structPubSubType::deleteData( } bool map_structPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool map_structPubSubType::getKey( return false; } - map_struct* p_type = static_cast(data); + const map_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h index ba83e337..df4db174 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h @@ -53,34 +53,34 @@ class map_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~map_structPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx index db386977..2f0bef6c 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "numeric_arrayCdrAux.hpp" #include "numeric_arrayTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; numeric_arrayPubSubType::numeric_arrayPubSubType() @@ -57,11 +57,11 @@ numeric_arrayPubSubType::~numeric_arrayPubSubType() } bool numeric_arrayPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - numeric_array* p_type = static_cast(data); + const numeric_array* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool numeric_arrayPubSubType::deserialize( } std::function numeric_arrayPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function numeric_arrayPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void numeric_arrayPubSubType::deleteData( } bool numeric_arrayPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool numeric_arrayPubSubType::getKey( return false; } - numeric_array* p_type = static_cast(data); + const numeric_array* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h index e6a48732..7926ec43 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h @@ -53,34 +53,34 @@ class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~numeric_arrayPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx index b480b644..42ae3286 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx @@ -27,8 +27,8 @@ #include "union_structCdrAux.hpp" #include "union_structTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; union_structPubSubType::union_structPubSubType() @@ -57,11 +57,11 @@ union_structPubSubType::~union_structPubSubType() } bool union_structPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - union_struct* p_type = static_cast(data); + const union_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool union_structPubSubType::deserialize( } std::function union_structPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function union_structPubSubType::getSerializedSizeProvider( 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)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void union_structPubSubType::deleteData( } bool union_structPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool union_structPubSubType::getKey( return false; } - union_struct* p_type = static_cast(data); + const union_struct* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h index 0b3e94a5..a2e412b4 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h @@ -53,34 +53,34 @@ class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~union_structPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; eProsima_user_DllExport void* createData() override; diff --git a/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp b/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp index 28bf7a2f..1251d8ea 100644 --- a/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp +++ b/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp @@ -44,41 +44,41 @@ TEST(GuidTest, is_valid) // Unknown guid invalid { Guid invalid_guid_1( - eprosima::fastrtps::rtps::GuidPrefix_t::unknown(), - eprosima::fastrtps::rtps::EntityId_t::unknown()); + eprosima::fastdds::rtps::GuidPrefix_t::unknown(), + eprosima::fastdds::rtps::EntityId_t::unknown()); ASSERT_FALSE(invalid_guid_1.is_valid()); Guid invalid_guid_2( - eprosima::fastrtps::rtps::GUID_t::unknown().guidPrefix, - eprosima::fastrtps::rtps::GUID_t::unknown().entityId); + eprosima::fastdds::rtps::GUID_t::unknown().guidPrefix, + eprosima::fastdds::rtps::GUID_t::unknown().entityId); ASSERT_FALSE(invalid_guid_2.is_valid()); } // GuidPrefix invalid { Guid invalid_guid( - eprosima::fastrtps::rtps::GuidPrefix_t(), // Invalid GuidPrefix - eprosima::fastrtps::rtps::EntityId_t(1)); // Valid EntityId + eprosima::fastdds::rtps::GuidPrefix_t(), // Invalid GuidPrefix + eprosima::fastdds::rtps::EntityId_t(1)); // Valid EntityId ASSERT_FALSE(invalid_guid.is_valid()); } // EntityId invalid { - eprosima::fastrtps::rtps::GuidPrefix_t guid_prefix; + eprosima::fastdds::rtps::GuidPrefix_t guid_prefix; std::istringstream("44.53.00.5f.45.50.52.4f.53.49.4d.41") >> guid_prefix; Guid valid_guid( guid_prefix, // Valid GuidPrefix - eprosima::fastrtps::rtps::EntityId_t()); // Invalid EntityId + eprosima::fastdds::rtps::EntityId_t()); // Invalid EntityId ASSERT_FALSE(valid_guid.is_valid()); } // Constrcutor with valid value { - eprosima::fastrtps::rtps::GuidPrefix_t guid_prefix; + eprosima::fastdds::rtps::GuidPrefix_t guid_prefix; std::istringstream("44.53.00.5f.45.50.52.4f.53.49.4d.41") >> guid_prefix; Guid valid_guid( guid_prefix, // Valid GuidPrefix - eprosima::fastrtps::rtps::EntityId_t(1)); // Valid EntityId + eprosima::fastdds::rtps::EntityId_t(1)); // Valid EntityId ASSERT_TRUE(valid_guid.is_valid()); } } diff --git a/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp b/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp index 02790473..d23c502e 100644 --- a/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp +++ b/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp @@ -31,7 +31,7 @@ namespace core { * * TODO: implement this class as an IPool (or having an internal pool), without being force to be unbounded. */ -class CacheChangePool : public fastrtps::rtps::IChangePool, public utils::UnboundedPool +class CacheChangePool : public fastdds::rtps::IChangePool, public utils::UnboundedPool { public: @@ -46,17 +46,17 @@ class CacheChangePool : public fastrtps::rtps::IChangePool, public utils::Unboun utils::PoolConfiguration configuration); //! Call UnboundedPool::reserve - bool reserve_cache( - fastrtps::rtps::CacheChange_t*& cache_change) override; + virtual bool reserve_cache( + fastdds::rtps::CacheChange_t*& cache_change) override; //! Call UnboundedPool::release - bool release_cache( - fastrtps::rtps::CacheChange_t* cache_change) override; + virtual bool release_cache( + fastdds::rtps::CacheChange_t* cache_change) override; protected: //! Override the UnboundedPool::create_element method to create a RouterCacheChange object. - fastrtps::rtps::CacheChange_t* new_element_() override; + virtual fastdds::rtps::CacheChange_t* new_element_() override; //! Override the IPool::reset_element_ method to reset the CacheChange as a new object. void reset_element_( diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index f19a8ad2..b5661f5d 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -108,17 +108,17 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain void on_participant_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::ParticipantDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; void on_data_reader_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; void on_data_writer_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; protected: diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 2c206425..109ae2cf 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -80,14 +80,14 @@ class DynTypesParticipant : public rtps::SimpleParticipant DDSPIPE_PARTICIPANTS_DllAPI void onReaderDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ReaderDiscoveryInfo&& info, bool& should_be_ignored) override; DDSPIPE_PARTICIPANTS_DllAPI void onWriterDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::WriterDiscoveryInfo&& info, bool& should_be_ignored) override; protected: diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index 185025ae..8b8fb3a9 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -49,7 +49,7 @@ namespace rtps { */ class CommonParticipant : public core::IParticipant - , public fastrtps::rtps::RTPSParticipantListener + , public fastdds::rtps::RTPSParticipantListener { public: @@ -127,8 +127,8 @@ class CommonParticipant */ DDSPIPE_PARTICIPANTS_DllAPI virtual void onParticipantDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ParticipantDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; /** @@ -138,8 +138,8 @@ class CommonParticipant */ DDSPIPE_PARTICIPANTS_DllAPI virtual void onReaderDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ReaderDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; /** @@ -149,8 +149,8 @@ class CommonParticipant */ DDSPIPE_PARTICIPANTS_DllAPI virtual void onWriterDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::WriterDiscoveryInfo&& info, bool& /*should_be_ignored*/) override; ////////////////// @@ -189,14 +189,14 @@ class CommonParticipant const std::shared_ptr& payload_pool, const std::shared_ptr& discovery_database, const core::types::DomainId& domain_id, - const fastrtps::rtps::RTPSParticipantAttributes& participant_attributes); + const fastdds::rtps::RTPSParticipantAttributes& participant_attributes); /** * @brief Auxiliary method to create the internal RTPS participant. */ void create_participant_( const core::types::DomainId& domain, - const fastrtps::rtps::RTPSParticipantAttributes& participant_attributes); + const fastdds::rtps::RTPSParticipantAttributes& participant_attributes); ///// // RTPS specific methods @@ -206,7 +206,7 @@ class CommonParticipant * * @note This method must be specialized from inherit classes. */ - static fastrtps::rtps::RTPSParticipantAttributes reckon_participant_attributes_( + static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( const ParticipantConfiguration* participant_configuration); ///// @@ -222,13 +222,13 @@ class CommonParticipant const std::shared_ptr discovery_database_; //! Internal RTPS Participant - eprosima::fastrtps::rtps::RTPSParticipant* rtps_participant_; + eprosima::fastdds::rtps::RTPSParticipant* rtps_participant_; //! Domain Id to create the internal RTPS Participant. core::types::DomainId domain_id_; //! Participant attributes to create the internal RTPS Participant. - fastrtps::rtps::RTPSParticipantAttributes participant_attributes_; + fastdds::rtps::RTPSParticipantAttributes participant_attributes_; }; } /* namespace rtps */ diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp index 0751d4bf..4289ebac 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp @@ -41,7 +41,7 @@ class DiscoveryServerParticipant protected: - static fastrtps::rtps::RTPSParticipantAttributes reckon_participant_attributes_( + static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( const DiscoveryServerParticipantConfiguration* participant_configuration); }; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp index 6df6c01a..dc6e0e76 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp @@ -42,7 +42,7 @@ class InitialPeersParticipant protected: - static fastrtps::rtps::RTPSParticipantAttributes reckon_participant_attributes_( + static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( const InitialPeersParticipantConfiguration* configuration); }; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp index ee18060e..46774a1c 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp @@ -52,7 +52,7 @@ class SimpleParticipant : public CommonParticipant /** * @brief Static method that gives the attributes for a Simple Participant. */ - static fastrtps::rtps::RTPSParticipantAttributes reckon_participant_attributes_( + static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( const SimpleParticipantConfiguration* configuration); }; diff --git a/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BaseReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BaseReader.hpp index 3754f499..999c90c3 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BaseReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BaseReader.hpp @@ -136,7 +136,7 @@ class BaseReader : public core::IReader //! Get internal RTPS reader mutex DDSPIPE_PARTICIPANTS_DllAPI - fastrtps::RecursiveTimedMutex& get_rtps_mutex() const override; + fastdds::RecursiveTimedMutex& get_rtps_mutex() const override; //! Get number of unread cache changes in internal RTPS reader DDSPIPE_PARTICIPANTS_DllAPI diff --git a/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BlankReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BlankReader.hpp index 338a716d..91214b44 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BlankReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/auxiliar/BlankReader.hpp @@ -64,7 +64,7 @@ class BlankReader : public core::IReader //! Get internal RTPS reader mutex DDSPIPE_PARTICIPANTS_DllAPI - fastrtps::RecursiveTimedMutex& get_rtps_mutex() const override; + fastdds::RecursiveTimedMutex& get_rtps_mutex() const override; //! Get number of unread cache changes in internal RTPS reader DDSPIPE_PARTICIPANTS_DllAPI diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rpc/SimpleReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rpc/SimpleReader.hpp index 939446c4..b358fd9e 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rpc/SimpleReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rpc/SimpleReader.hpp @@ -48,17 +48,17 @@ class SimpleReader : public rtps::CommonReader const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant); + fastdds::rtps::RTPSParticipant* rtps_participant); //! Override Parent method to create an RPC data type. DDSPIPE_PARTICIPANTS_DllAPI virtual core::types::RtpsPayloadData* create_data_( - const fastrtps::rtps::CacheChange_t& received_change) const noexcept override; + const fastdds::rtps::CacheChange_t& received_change) const noexcept override; //! Override Parent method to fill fields exclusive from RPC. DDSPIPE_PARTICIPANTS_DllAPI virtual void fill_received_data_( - const fastrtps::rtps::CacheChange_t& received_change, + const fastdds::rtps::CacheChange_t& received_change, core::types::RtpsPayloadData& data_to_fill) const noexcept override; }; diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index d251e592..8304e884 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -48,7 +48,7 @@ namespace rtps { * * @warning This object is not RAII and must be initialized before used. */ -class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener +class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener { public: @@ -96,8 +96,8 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI void on_new_cache_change_added( - fastrtps::rtps::RTPSReader*, - const fastrtps::rtps::CacheChange_t* const change) noexcept override; + fastdds::rtps::RTPSReader*, + const fastdds::rtps::CacheChange_t* const change) noexcept override; /** * @brief CommonReader Listener callback when a new Writer is matched or unmatched @@ -109,8 +109,8 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI void on_reader_matched( - fastrtps::rtps::RTPSReader*, - const fastrtps::rtps::MatchingInfo& info) noexcept override; + fastdds::rtps::RTPSReader*, + const fastdds::rtps::MatchingInfo& info) noexcept override; /** * This method is called when a new Writer is discovered, with a Topic that @@ -131,7 +131,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI void on_sample_lost( - fastrtps::rtps::RTPSReader*, + fastdds::rtps::RTPSReader*, int32_t sample_lost_since_last_update) noexcept override; /** @@ -143,9 +143,9 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI void on_sample_rejected( - fastrtps::rtps::RTPSReader*, + fastdds::rtps::RTPSReader*, eprosima::fastdds::dds::SampleRejectedStatusKind reason, - const fastrtps::rtps::CacheChange_t* const change) noexcept override; + const fastdds::rtps::CacheChange_t* const change) noexcept override; /** * This method is called when a new Writer is discovered, with a Topic that @@ -155,7 +155,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI void on_incompatible_type( - fastrtps::rtps::RTPSReader* reader) noexcept override; + fastdds::rtps::RTPSReader* reader) noexcept override; ///////////////////////// // RPC REQUIRED METHODS @@ -168,7 +168,7 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener //! Get internal RTPS reader mutex DDSPIPE_PARTICIPANTS_DllAPI - fastrtps::RecursiveTimedMutex& get_rtps_mutex() const noexcept override; + fastdds::RecursiveTimedMutex& get_rtps_mutex() const noexcept override; //! Get number of unread cache changes in internal RTPS reader DDSPIPE_PARTICIPANTS_DllAPI @@ -193,10 +193,10 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::ReaderAttributes& reader_attributes, - const fastrtps::TopicAttributes& topic_attributes, + fastdds::rtps::RTPSParticipant* rtps_participant, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::ReaderAttributes& reader_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::ReaderQos& reader_qos); // Specific enable/disable do not need to be implemented @@ -206,9 +206,9 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI virtual void internal_entities_creation_( - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::ReaderAttributes& reader_attributes, - const fastrtps::TopicAttributes& topic_attributes, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::ReaderAttributes& reader_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::ReaderQos& reader_qos); /** @@ -218,14 +218,14 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI virtual core::types::RtpsPayloadData* create_data_( - const fastrtps::rtps::CacheChange_t& received_change) const noexcept; + const fastdds::rtps::CacheChange_t& received_change) const noexcept; /** * @brief Auxiliary method used in \c take to fill the received data. */ DDSPIPE_PARTICIPANTS_DllAPI virtual void fill_received_data_( - const fastrtps::rtps::CacheChange_t& received_change, + const fastdds::rtps::CacheChange_t& received_change, core::types::RtpsPayloadData& data_to_fill) const noexcept; // Specific enable/disable do not need to be implemented @@ -260,17 +260,17 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener * * @return Default HistoryAttributes */ - static fastrtps::rtps::HistoryAttributes reckon_history_attributes_( + static fastdds::rtps::HistoryAttributes reckon_history_attributes_( const core::types::DdsTopic& topic) noexcept; /** * @brief Reader Attributes to create RTPS Reader */ - static fastrtps::rtps::ReaderAttributes reckon_reader_attributes_( + static fastdds::rtps::ReaderAttributes reckon_reader_attributes_( const core::types::DdsTopic& topic) noexcept; //! Topic Attributes to create RTPS Reader - static fastrtps::TopicAttributes reckon_topic_attributes_( + static fastdds::TopicAttributes reckon_topic_attributes_( const core::types::DdsTopic& topic) noexcept; //! Reader QoS to create RTPS Reader @@ -282,24 +282,24 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener //! Whether a change received should be processed virtual bool should_accept_change_( - const fastrtps::rtps::CacheChange_t* change) noexcept; + const fastdds::rtps::CacheChange_t* change) noexcept; //! Whether a change received is from this Participant (to avoid auto-feedback) bool come_from_this_participant_( - const fastrtps::rtps::CacheChange_t* change) const noexcept; + const fastdds::rtps::CacheChange_t* change) const noexcept; //! Whether a guid references this Participant (to avoid auto-feedback) bool come_from_this_participant_( - const fastrtps::rtps::GUID_t guid) const noexcept; + const fastdds::rtps::GUID_t guid) const noexcept; utils::ReturnCode is_data_correct_( - const fastrtps::rtps::CacheChange_t* received_change) const noexcept; + const fastdds::rtps::CacheChange_t* received_change) const noexcept; ///// // EXTERNAL VARIABLES //! RTPS Participant - fastrtps::rtps::RTPSParticipant* rtps_participant_; + fastdds::rtps::RTPSParticipant* rtps_participant_; ///// // INTERNAL VARIABLES @@ -310,19 +310,19 @@ class CommonReader : public BaseReader, public fastrtps::rtps::ReaderListener core::types::DdsTopic topic_; //! RTPS Reader pointer - fastrtps::rtps::RTPSReader* rtps_reader_; + fastdds::rtps::RTPSReader* rtps_reader_; //! RTPS Reader History associated to \c rtps_reader_ - fastrtps::rtps::ReaderHistory* rtps_history_; + fastdds::rtps::ReaderHistory* rtps_history_; //! History attributes to create the History for the internal RTPS Reader. - fastrtps::rtps::HistoryAttributes history_attributes_; + fastdds::rtps::HistoryAttributes history_attributes_; //! Reader attributes to create the internal RTPS Reader. - fastrtps::rtps::ReaderAttributes reader_attributes_; + fastdds::rtps::ReaderAttributes reader_attributes_; //! Topic attributes to create the internal RTPS Reader. - fastrtps::TopicAttributes topic_attributes_; + fastdds::TopicAttributes topic_attributes_; //! Reader QoS to create the internal RTPS Reader. fastdds::dds::ReaderQos reader_qos_; diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp index f219a107..03f4d66f 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp @@ -46,7 +46,7 @@ class SimpleReader : public CommonReader const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant); + fastdds::rtps::RTPSParticipant* rtps_participant); }; } /* namespace rtps */ diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/SpecificQoSReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/SpecificQoSReader.hpp index 910665e9..71813456 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/SpecificQoSReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/SpecificQoSReader.hpp @@ -51,7 +51,7 @@ class SpecificQoSReader : public CommonReader const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const std::shared_ptr& discovery_database); protected: @@ -60,7 +60,7 @@ class SpecificQoSReader : public CommonReader * Specializes \c CommonReader method and set the QoS of the data received. */ virtual void fill_received_data_( - const fastrtps::rtps::CacheChange_t& received_change, + const fastdds::rtps::CacheChange_t& received_change, core::types::RtpsPayloadData& data_to_fill) const noexcept override; diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp index 5f0d89da..3d8f78e7 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp @@ -33,19 +33,19 @@ namespace types { * This Change is required to be used for features: * - Repeater participant: avoid redirecting the message to the source participant. */ -struct RouterCacheChange : public fastrtps::rtps::CacheChange_t +struct RouterCacheChange : public fastdds::rtps::CacheChange_t { public: //! Using parent constructors - using fastrtps::rtps::CacheChange_t::CacheChange_t; + using fastdds::rtps::CacheChange_t::CacheChange_t; /** * @brief GuidPrefix of the Participant that has sent this message through the pipe. * * @note it is not the same as origin writer, as there could be more pipes in the path. */ - fastrtps::rtps::GuidPrefix_t last_writer_guid_prefix; + fastdds::rtps::GuidPrefix_t last_writer_guid_prefix; }; } /* namespace types */ diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp index 0225a8f1..97d71c4c 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp @@ -55,25 +55,25 @@ class TopicDataType : public eprosima::fastdds::dds::TopicDataType //! \c serialize method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; + const void* data, + eprosima::fastdds::rtps::SerializedPayload_t* payload) override; //! \c deserialize method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t* payload, void* data) override; //! \c getSerializedSizeProvider method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI virtual std::function getSerializedSizeProvider( - void* data) override; + const void* data) override; //! \c getKey method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* handle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* handle, bool force_md5 = false) override; //! \c createData method overriden from \c TopicDataType diff --git a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp index b33fd5d4..177cee1e 100644 --- a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp +++ b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp @@ -46,11 +46,11 @@ core::types::Endpoint create_endpoint_from_info_( const core::types::ParticipantId participant_discoverer_id); bool come_from_same_participant_( - const fastrtps::rtps::GUID_t src_guid, - const fastrtps::rtps::GUID_t target_guid) noexcept; + const fastdds::rtps::GUID_t src_guid, + const fastdds::rtps::GUID_t target_guid) noexcept; -fastrtps::rtps::GUID_t guid_from_instance_handle( - const fastrtps::rtps::InstanceHandle_t& ihandle) noexcept; +fastdds::rtps::GUID_t guid_from_instance_handle( + const fastdds::rtps::InstanceHandle_t& ihandle) noexcept; } /* namespace detail */ } /* namespace participants */ diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp index 81fe1069..06f7eec7 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp @@ -59,20 +59,20 @@ class SimpleWriter : public rtps::CommonWriter const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater = false); //! Override Parent method to fill fields only required for RPC. DDSPIPE_PARTICIPANTS_DllAPI virtual utils::ReturnCode fill_to_send_data_( - fastrtps::rtps::CacheChange_t* to_send_change_to_fill, - eprosima::fastrtps::rtps::WriteParams& to_send_params, + fastdds::rtps::CacheChange_t* to_send_change_to_fill, + eprosima::fastdds::rtps::WriteParams& to_send_params, const core::types::RtpsPayloadData& data) const noexcept; //! Override Parent method to fill fields after message is sent only required for RPC. DDSPIPE_PARTICIPANTS_DllAPI virtual void fill_sent_data_( - const eprosima::fastrtps::rtps::WriteParams& sent_params, + const eprosima::fastdds::rtps::WriteParams& sent_params, core::types::RtpsPayloadData& data_to_fill) const noexcept; }; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index cc250aa1..45418481 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -66,7 +66,7 @@ namespace rtps { * * @warning This object is not RAII and must be initialized before used. */ -class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener +class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener { public: @@ -113,8 +113,8 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener */ DDSPIPE_PARTICIPANTS_DllAPI void onWriterMatched( - fastrtps::rtps::RTPSWriter*, - fastrtps::rtps::MatchingInfo& info) noexcept override; + fastdds::rtps::RTPSWriter*, + fastdds::rtps::MatchingInfo& info) noexcept override; /** * @brief CommonWriter Listener callback when all the Readers have received a change. @@ -126,8 +126,8 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener */ DDSPIPE_PARTICIPANTS_DllAPI void onWriterChangeReceivedByAll( - fastrtps::rtps::RTPSWriter*, - fastrtps::rtps::CacheChange_t* change) override; + fastdds::rtps::RTPSWriter*, + fastdds::rtps::CacheChange_t* change) override; /** * This method is called when a new Reader is discovered, with a Topic that @@ -137,8 +137,8 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener */ DDSPIPE_PARTICIPANTS_DllAPI void on_offered_incompatible_qos( - fastrtps::rtps::RTPSWriter*, - fastdds::dds::PolicyMask qos) noexcept override; + fastdds::rtps::RTPSWriter*, + eprosima::fastdds::dds::PolicyMask qos) noexcept override; ///////////////////// // STATIC ATTRIBUTES @@ -164,11 +164,11 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater, - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::WriterAttributes& writer_attributes, - const fastrtps::TopicAttributes& topic_attributes, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::WriterAttributes& writer_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration); @@ -202,8 +202,8 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener */ DDSPIPE_PARTICIPANTS_DllAPI virtual utils::ReturnCode fill_to_send_data_( - fastrtps::rtps::CacheChange_t* to_send_change_to_fill, - eprosima::fastrtps::rtps::WriteParams& to_send_params, + fastdds::rtps::CacheChange_t* to_send_change_to_fill, + eprosima::fastdds::rtps::WriteParams& to_send_params, const core::types::RtpsPayloadData& data) const noexcept; /** @@ -214,7 +214,7 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener */ DDSPIPE_PARTICIPANTS_DllAPI virtual void fill_sent_data_( - const eprosima::fastrtps::rtps::WriteParams& sent_params, + const eprosima::fastdds::rtps::WriteParams& sent_params, core::types::RtpsPayloadData& data_to_fill) const noexcept; ///// @@ -229,26 +229,26 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener * @param rtps_participant */ void internal_entities_creation_( - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::WriterAttributes& writer_attributes, - const fastrtps::TopicAttributes& topic_attributes, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::WriterAttributes& writer_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration); /** * @brief History Attributes to create RTPS Writer History */ - static fastrtps::rtps::HistoryAttributes reckon_history_attributes_( + static fastdds::rtps::HistoryAttributes reckon_history_attributes_( const core::types::DdsTopic& topic) noexcept; /** * @brief Writer Attributes to create RTPS Writer */ - static fastrtps::rtps::WriterAttributes reckon_writer_attributes_( + static fastdds::rtps::WriterAttributes reckon_writer_attributes_( const core::types::DdsTopic& topic) noexcept; //! Topic Attributes to create RTPS Writer - static fastrtps::TopicAttributes reckon_topic_attributes_( + static fastdds::TopicAttributes reckon_topic_attributes_( const core::types::DdsTopic& topic) noexcept; //! QoS for RTPS Writer @@ -261,13 +261,13 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener //! Whether a guid references this Participant bool come_from_this_participant_( - const fastrtps::rtps::GUID_t guid) const noexcept; + const fastdds::rtps::GUID_t guid) const noexcept; ///// // EXTERNAL VARIABLES //! RTPS Participant - fastrtps::rtps::RTPSParticipant* rtps_participant_; + fastdds::rtps::RTPSParticipant* rtps_participant_; //! Whether it is repeater or not (used for data filters and/or qos) bool repeater_; @@ -280,22 +280,22 @@ class CommonWriter : public BaseWriter, public fastrtps::rtps::WriterListener const std::shared_ptr& payload_pool_; //! RTPS CommonWriter pointer - fastrtps::rtps::RTPSWriter* rtps_writer_; + fastdds::rtps::RTPSWriter* rtps_writer_; //! RTPS CommonWriter History associated to \c rtps_reader_ - fastrtps::rtps::WriterHistory* rtps_history_; + fastdds::rtps::WriterHistory* rtps_history_; //! Data Filter used to filter cache changes at the RTPSWriter level. std::unique_ptr data_filter_; //! History attributes to create the History for the internal RTPS Writer. - fastrtps::rtps::HistoryAttributes history_attributes_; + fastdds::rtps::HistoryAttributes history_attributes_; //! Writer attributes to create the internal RTPS Writer. - fastrtps::rtps::WriterAttributes writer_attributes_; + fastdds::rtps::WriterAttributes writer_attributes_; //! Topic attributes to create the internal RTPS Writer. - fastrtps::TopicAttributes topic_attributes_; + fastdds::TopicAttributes topic_attributes_; //! Writer QoS to create the internal RTPS Writer. fastdds::dds::WriterQos writer_qos_; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/MultiWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/MultiWriter.hpp index 4f9047e0..86a01225 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/MultiWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/MultiWriter.hpp @@ -55,7 +55,7 @@ class MultiWriter : public BaseWriter const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater = false); /** @@ -102,7 +102,7 @@ class MultiWriter : public BaseWriter core::types::DdsTopic topic_; //! Reference to RTPS Participant. - fastrtps::rtps::RTPSParticipant* rtps_participant_; + fastdds::rtps::RTPSParticipant* rtps_participant_; //! Whether this Writer is a repeater. bool repeater_; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp index fba496f0..ed9d2de5 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp @@ -57,7 +57,7 @@ class QoSSpecificWriter : public CommonWriter const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const core::types::SpecificEndpointQoS& specific_qos, const bool repeater = false); diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp index a7ad3f6f..aa0f413b 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp @@ -59,7 +59,7 @@ class SimpleWriter : public CommonWriter const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater = false); }; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/RepeaterDataFilter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/RepeaterDataFilter.hpp index 93ae3cab..fa012cb2 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/RepeaterDataFilter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/RepeaterDataFilter.hpp @@ -42,8 +42,8 @@ class RepeaterDataFilter : public SelfDataFilter */ DDSPIPE_PARTICIPANTS_DllAPI bool is_relevant( - const fastrtps::rtps::CacheChange_t& change, - const fastrtps::rtps::GUID_t& reader_guid + const fastdds::rtps::CacheChange_t& change, + const fastdds::rtps::GUID_t& reader_guid ) const override; }; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp index 4f401618..eddcfacd 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp @@ -51,8 +51,8 @@ class SelfDataFilter : public fastdds::rtps::IReaderDataFilter */ DDSPIPE_PARTICIPANTS_DllAPI bool is_relevant( - const fastrtps::rtps::CacheChange_t& change, - const fastrtps::rtps::GUID_t& reader_guid + const fastdds::rtps::CacheChange_t& change, + const fastdds::rtps::GUID_t& reader_guid ) const override; }; diff --git a/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp b/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp index 8dbbe143..0a06a978 100644 --- a/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp +++ b/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp @@ -24,24 +24,24 @@ namespace core { CacheChangePool::CacheChangePool( utils::PoolConfiguration configuration) - : utils::UnboundedPool(configuration) + : utils::UnboundedPool(configuration) { initialize_vector_(); } bool CacheChangePool::reserve_cache( - fastrtps::rtps::CacheChange_t*& cache_change) + fastdds::rtps::CacheChange_t*& cache_change) { return loan(cache_change); } bool CacheChangePool::release_cache( - fastrtps::rtps::CacheChange_t* cache_change) + fastdds::rtps::CacheChange_t* cache_change) { return return_loan(cache_change); } -fastrtps::rtps::CacheChange_t* CacheChangePool::new_element_() +fastdds::rtps::CacheChange_t* CacheChangePool::new_element_() { return new types::RouterCacheChange(); } diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 0534890b..7085ebf2 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -217,29 +217,29 @@ std::shared_ptr CommonParticipant::create_reader( void CommonParticipant::on_participant_discovery( fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::ParticipantDiscoveryInfo&& info, bool&) { if (info.info.m_guid.guidPrefix != participant->guid().guidPrefix) { - if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) + if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Participant " << info.info.m_guid << "."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); } @@ -248,7 +248,7 @@ void CommonParticipant::on_participant_discovery( void CommonParticipant::on_data_reader_discovery( fastdds::dds::DomainParticipant*, - fastrtps::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryInfo&& info, bool&) { // If reader is from other participant, store it in discovery database @@ -260,10 +260,10 @@ void CommonParticipant::on_data_reader_discovery( // Calculate endpoint info core::types::Endpoint info_reader = - detail::create_endpoint_from_info_(info, id()); + detail::create_endpoint_from_info_(info, id()); // If new endpoint discovered - if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_READER) + if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_READER) { logInfo(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Reader " << info.info.guid() << "."); @@ -271,20 +271,20 @@ void CommonParticipant::on_data_reader_discovery( // TODO check logic because if an endpoint is lost by liveliness it may be inserted again when already in database this->discovery_database_->add_endpoint(info_reader); } - else if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::CHANGED_QOS_READER) + else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::CHANGED_QOS_READER) { logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER) + else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::REMOVED_READER) { logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::IGNORED_READER) + else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::IGNORED_READER) { logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); @@ -294,7 +294,7 @@ void CommonParticipant::on_data_reader_discovery( void CommonParticipant::on_data_writer_discovery( fastdds::dds::DomainParticipant*, - fastrtps::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryInfo&& info, bool&) { // If writer is from other participant, store it in discovery database @@ -306,10 +306,10 @@ void CommonParticipant::on_data_writer_discovery( // Calculate endpoint info core::types::Endpoint info_writer = - detail::create_endpoint_from_info_(info, id()); + detail::create_endpoint_from_info_(info, id()); // If new endpoint discovered - if (info.status == fastrtps::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_WRITER) + if (info.status == fastdds::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Writer " << info.info.guid() << "."); @@ -317,20 +317,20 @@ void CommonParticipant::on_data_writer_discovery( // TODO check logic because if an endpoint is lost by liveliness it may be inserted again when already in database this->discovery_database_->add_endpoint(info_writer); } - else if (info.status == fastrtps::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) + else if (info.status == fastdds::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER) + else if (info.status == fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastrtps::rtps::WriterDiscoveryInfo::IGNORED_WRITER) + else if (info.status == fastdds::rtps::WriterDiscoveryInfo::IGNORED_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index b57c6ac2..851ed9a9 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -16,7 +16,7 @@ #include #include -// #include +#include #include #include @@ -39,14 +39,14 @@ XmlParticipant::XmlParticipant( : CommonParticipant(participant_configuration, payload_pool, discovery_database) , xml_specific_configuration_(*reinterpret_cast(configuration_.get())) { - // fastdds::dds::DomainParticipantExtendedQos extended_qos; - // if (xml_specific_configuration_.participant_profile.is_set() && - // fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( - // xml_specific_configuration_.participant_profile.get_value(), - // extended_qos)) - // { - // configuration_->domain = extended_qos.domainId(); - // } + fastdds::dds::DomainParticipantExtendedQos extended_qos; + if (xml_specific_configuration_.participant_profile.is_set() && + fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( + xml_specific_configuration_.participant_profile.get_value(), + extended_qos)) + { + configuration_->domain = extended_qos.domainId(); + } } std::shared_ptr XmlParticipant::create_writer( diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 4e391d12..8e790cdb 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -91,11 +91,11 @@ std::shared_ptr DynTypesParticipant::create_reader( } void DynTypesParticipant::onReaderDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ReaderDiscoveryInfo&& info, bool& should_be_ignored) { - fastrtps::rtps::ReaderProxyData proxy_copy(info.info); + fastdds::rtps::ReaderProxyData proxy_copy(info.info); // Get type information const auto type_info = proxy_copy.type_information().type_information; @@ -107,11 +107,11 @@ void DynTypesParticipant::onReaderDiscovery( } void DynTypesParticipant::onWriterDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::WriterDiscoveryInfo&& info, bool& should_be_ignored) { - fastrtps::rtps::WriterProxyData proxy_copy(info.info); + fastdds::rtps::WriterProxyData proxy_copy(info.info); // Get type information const auto type_info = proxy_copy.type_information().type_information; diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index bbd66440..dcda5204 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -55,7 +55,7 @@ CommonParticipant::CommonParticipant( const std::shared_ptr& payload_pool, const std::shared_ptr& discovery_database, const core::types::DomainId& domain_id, - const fastrtps::rtps::RTPSParticipantAttributes& participant_attributes) + const fastdds::rtps::RTPSParticipantAttributes& participant_attributes) : configuration_(participant_configuration) , payload_pool_(payload_pool) , discovery_database_(discovery_database) @@ -69,7 +69,7 @@ CommonParticipant::~CommonParticipant() { if (rtps_participant_) { - fastrtps::rtps::RTPSDomain::removeRTPSParticipant(rtps_participant_); + fastdds::rtps::RTPSDomain::removeRTPSParticipant(rtps_participant_); } } @@ -81,30 +81,30 @@ void CommonParticipant::init() } void CommonParticipant::onParticipantDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ParticipantDiscoveryInfo&& info, bool&) { if (info.info.m_guid.guidPrefix != participant->getGuid().guidPrefix) { - if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) + if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Participant " << info.info.m_guid << "."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); } - else if (info.status == fastrtps::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) + else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) { logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); } @@ -112,36 +112,36 @@ void CommonParticipant::onParticipantDiscovery( } void CommonParticipant::onReaderDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ReaderDiscoveryInfo&& info, bool&) { if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) { - core::types::Endpoint info_reader = detail::create_endpoint_from_info_( + core::types::Endpoint info_reader = detail::create_endpoint_from_info_( info, this->id()); - if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERED_READER) + if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERED_READER) { logInfo(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Reader " << info.info.guid() << "."); this->discovery_database_->add_endpoint(info_reader); } - else if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::CHANGED_QOS_READER) + else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::CHANGED_QOS_READER) { logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER) + else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::REMOVED_READER) { logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastrtps::rtps::ReaderDiscoveryInfo::IGNORED_READER) + else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::IGNORED_READER) { logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); @@ -151,36 +151,36 @@ void CommonParticipant::onReaderDiscovery( } void CommonParticipant::onWriterDiscovery( - fastrtps::rtps::RTPSParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::WriterDiscoveryInfo&& info, bool&) { if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) { - core::types::Endpoint info_writer = detail::create_endpoint_from_info_( + core::types::Endpoint info_writer = detail::create_endpoint_from_info_( info, this->id()); - if (info.status == fastrtps::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER) + if (info.status == fastdds::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Writer " << info.info.guid() << "."); this->discovery_database_->add_endpoint(info_writer); } - else if (info.status == fastrtps::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) + else if (info.status == fastdds::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER) + else if (info.status == fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastrtps::rtps::WriterDiscoveryInfo::IGNORED_WRITER) + else if (info.status == fastdds::rtps::WriterDiscoveryInfo::IGNORED_WRITER) { logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); @@ -337,14 +337,14 @@ core::types::TopicQoS CommonParticipant::topic_qos() const noexcept void CommonParticipant::create_participant_( const core::types::DomainId& domain, - const fastrtps::rtps::RTPSParticipantAttributes& participant_attributes) + const fastdds::rtps::RTPSParticipantAttributes& participant_attributes) { logInfo(DDSPIPE_RTPS_PARTICIPANT, "Creating Participant in domain " << domain); // Listener must be set in creation as no callbacks should be missed // It is safe to do so here as object is already created and callbacks do not require anything set in this method - rtps_participant_ = fastrtps::rtps::RTPSDomain::createParticipant( + rtps_participant_ = fastdds::rtps::RTPSDomain::createParticipant( domain, participant_attributes, this); @@ -481,11 +481,11 @@ std::shared_ptr CommonParticipant::create_reader( } } -fastrtps::rtps::RTPSParticipantAttributes +fastdds::rtps::RTPSParticipantAttributes CommonParticipant::reckon_participant_attributes_( const ParticipantConfiguration* participant_configuration) { - fastrtps::rtps::RTPSParticipantAttributes params; + fastdds::rtps::RTPSParticipantAttributes params; // Add Participant name params.setName(participant_configuration->id.c_str()); diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index b74e30d8..cf5c1625 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -43,12 +43,12 @@ DiscoveryServerParticipant::DiscoveryServerParticipant( { } -fastrtps::rtps::RTPSParticipantAttributes +fastdds::rtps::RTPSParticipantAttributes DiscoveryServerParticipant::reckon_participant_attributes_( const DiscoveryServerParticipantConfiguration* configuration) { // Use default as base attributes - fastrtps::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); + fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); // Auxiliary variable to save characters and improve readability const core::types::GuidPrefix& discovery_server_guid_prefix = configuration->discovery_server_guid_prefix; @@ -161,21 +161,21 @@ DiscoveryServerParticipant::reckon_participant_attributes_( // For any, UDP or TCP // Create Locator - eprosima::fastrtps::rtps::Locator_t locator; + eprosima::fastdds::rtps::Locator_t locator; locator.kind = address.get_locator_kind(); // IP if (address.is_ipv4()) { - eprosima::fastrtps::rtps::IPLocator::setIPv4(locator, address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv4(locator, address.ip()); } else { - eprosima::fastrtps::rtps::IPLocator::setIPv6(locator, address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv6(locator, address.ip()); } // Port - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(locator, address.port()); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, address.port()); if (address.is_tcp()) { @@ -185,8 +185,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_( // port announced is equal to the internal port. // If external port is defined, announced port is external port. This is the one clients, // should try to connect, which should match network router public port. - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(locator, address.external_port()); - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(locator, address.external_port()); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, address.external_port()); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(locator, address.external_port()); } // Add listening address to builtin @@ -229,10 +229,10 @@ DiscoveryServerParticipant::reckon_participant_attributes_( has_connection_addresses = true; - eprosima::fastrtps::rtps::RemoteServerAttributes server_attr; + eprosima::fastdds::rtps::RemoteServerAttributes server_attr; server_attr.guidPrefix = server_prefix; - eprosima::fastrtps::rtps::Locator_t locator; + eprosima::fastdds::rtps::Locator_t locator; // KIND locator.kind = address.get_locator_kind(); @@ -252,16 +252,16 @@ DiscoveryServerParticipant::reckon_participant_attributes_( // IP if (address.is_ipv4()) { - eprosima::fastrtps::rtps::IPLocator::setIPv4(locator, address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv4(locator, address.ip()); } else { - eprosima::fastrtps::rtps::IPLocator::setIPv6(locator, address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv6(locator, address.ip()); } // PORT - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(locator, address.port()); - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(locator, address.port()); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, address.port()); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(locator, address.port()); // Warning: Logical port is not needed unless domain could change // Add as remote server and add it to builtin @@ -279,12 +279,12 @@ DiscoveryServerParticipant::reckon_participant_attributes_( if (has_listening_addresses) { params.builtin.discovery_config.discoveryProtocol = - fastrtps::rtps::DiscoveryProtocol::SERVER; + fastdds::rtps::DiscoveryProtocol::SERVER; } else { params.builtin.discovery_config.discoveryProtocol = - fastrtps::rtps::DiscoveryProtocol::SUPER_CLIENT; + fastdds::rtps::DiscoveryProtocol::SUPER_CLIENT; if (!has_connection_addresses) { diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index c38a8e14..2b19f7ed 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -39,11 +39,11 @@ InitialPeersParticipant::InitialPeersParticipant( { } -fastrtps::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_participant_attributes_( +fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_participant_attributes_( const InitialPeersParticipantConfiguration* configuration) { // Use default as base attributes - fastrtps::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); + fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); // Auxiliary variable to save characters and improve readability const auto& tls_config = configuration->tls_configuration; @@ -156,21 +156,21 @@ fastrtps::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partic // For any, UDP or TCP // Create Locator - eprosima::fastrtps::rtps::Locator_t locator; + eprosima::fastdds::rtps::Locator_t locator; locator.kind = address.get_locator_kind(); // IP if (address.is_ipv4()) { - eprosima::fastrtps::rtps::IPLocator::setIPv4(locator, address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv4(locator, address.ip()); } else { - eprosima::fastrtps::rtps::IPLocator::setIPv6(locator, address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv6(locator, address.ip()); } // Set Logical port for every locator - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(locator, address.port()); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, address.port()); // In TCP case, set Physical port if (address.is_tcp()) @@ -181,8 +181,8 @@ fastrtps::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partic // port announced is equal to the internal port. // If external port is defined, announced port is external port. This is the one clients, // should try to connect, which should match network router public port. - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(locator, address.external_port()); - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(locator, 0); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, address.external_port()); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(locator, 0); } // Add listening address to builtin @@ -207,7 +207,7 @@ fastrtps::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partic } // Create Locator for connection initial peers - eprosima::fastrtps::rtps::Locator_t locator; + eprosima::fastdds::rtps::Locator_t locator; // KIND locator.kind = connection_address.get_locator_kind(); @@ -229,15 +229,15 @@ fastrtps::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partic // IP if (connection_address.is_ipv4()) { - eprosima::fastrtps::rtps::IPLocator::setIPv4(locator, connection_address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv4(locator, connection_address.ip()); } else { - eprosima::fastrtps::rtps::IPLocator::setIPv6(locator, connection_address.ip()); + eprosima::fastdds::rtps::IPLocator::setIPv6(locator, connection_address.ip()); } // Set Physical port for every locator - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(locator, connection_address.port()); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, connection_address.port()); // TCP client side // Initial peer physical port must match server's public port. If server specified an external port, @@ -246,7 +246,7 @@ fastrtps::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partic // In TCP case, set Logical port if (connection_address.is_tcp()) { - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(locator, 0); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(locator, 0); } // Add it to builtin @@ -322,14 +322,14 @@ fastrtps::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partic { if (has_connection_udp_ipv4) { - eprosima::fastrtps::rtps::Locator_t locator; + eprosima::fastdds::rtps::Locator_t locator; locator.kind = LOCATOR_KIND_UDPv4; params.builtin.metatrafficUnicastLocatorList.push_back(locator); } if (has_connection_udp_ipv6) { - eprosima::fastrtps::rtps::Locator_t locator; + eprosima::fastdds::rtps::Locator_t locator; locator.kind = LOCATOR_KIND_UDPv6; params.builtin.metatrafficUnicastLocatorList.push_back(locator); } diff --git a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp index d13e56aa..bfcdb88d 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp @@ -40,12 +40,12 @@ SimpleParticipant::SimpleParticipant( { } -fastrtps::rtps::RTPSParticipantAttributes +fastdds::rtps::RTPSParticipantAttributes SimpleParticipant::reckon_participant_attributes_( const SimpleParticipantConfiguration* configuration) { // Use default as base attributes - fastrtps::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); + fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); // Configure Participant transports if (configuration->transport == core::types::TransportDescriptors::builtin) @@ -85,25 +85,25 @@ SimpleParticipant::reckon_participant_attributes_( { case core::types::IgnoreParticipantFlags::no_filter: params.builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::NO_FILTER; + eprosima::fastdds::rtps::ParticipantFilteringFlags::NO_FILTER; break; case core::types::IgnoreParticipantFlags::filter_different_host: params.builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_HOST; + eprosima::fastdds::rtps::ParticipantFilteringFlags::FILTER_DIFFERENT_HOST; break; case core::types::IgnoreParticipantFlags::filter_different_process: params.builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_PROCESS; + eprosima::fastdds::rtps::ParticipantFilteringFlags::FILTER_DIFFERENT_PROCESS; break; case core::types::IgnoreParticipantFlags::filter_same_process: params.builtin.discovery_config.ignoreParticipantFlags = - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_SAME_PROCESS; + eprosima::fastdds::rtps::ParticipantFilteringFlags::FILTER_SAME_PROCESS; break; case core::types::IgnoreParticipantFlags::filter_different_and_same_process: params.builtin.discovery_config.ignoreParticipantFlags = - static_cast( - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_PROCESS | - eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_SAME_PROCESS); + static_cast( + eprosima::fastdds::rtps::ParticipantFilteringFlags::FILTER_DIFFERENT_PROCESS | + eprosima::fastdds::rtps::ParticipantFilteringFlags::FILTER_SAME_PROCESS); break; default: break; diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp index a6522703..b4b3876f 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp @@ -191,7 +191,7 @@ core::types::Guid BaseReader::guid() const throw utils::UnsupportedException("guid method not allowed for non RTPS readers."); } -fastrtps::RecursiveTimedMutex& BaseReader::get_rtps_mutex() const +fastdds::RecursiveTimedMutex& BaseReader::get_rtps_mutex() const { throw utils::UnsupportedException("get_rtps_mutex method not allowed for non RTPS readers."); } diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp index bedb2160..8f8b9f74 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp @@ -49,7 +49,7 @@ core::types::Guid BlankReader::guid() const throw utils::UnsupportedException("guid method not allowed for non RTPS readers."); } -fastrtps::RecursiveTimedMutex& BlankReader::get_rtps_mutex() const +fastdds::RecursiveTimedMutex& BlankReader::get_rtps_mutex() const { throw utils::UnsupportedException("get_rtps_mutex method not allowed for non RTPS readers."); } diff --git a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp index 6d9423bd..821cb9f3 100644 --- a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp @@ -31,7 +31,7 @@ SimpleReader::SimpleReader( const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant) + fastdds::rtps::RTPSParticipant* rtps_participant) : CommonReader( participant_id, topic, payload_pool, rtps_participant, reckon_history_attributes_(topic), @@ -44,14 +44,14 @@ SimpleReader::SimpleReader( //! Override Parent method to create an RPC data type. core::types::RtpsPayloadData* SimpleReader::create_data_( - const fastrtps::rtps::CacheChange_t& received_change) const noexcept + const fastdds::rtps::CacheChange_t& received_change) const noexcept { return new core::types::RpcPayloadData(); } //! Override Parent method to fill fields exclusive from RPC. void SimpleReader::fill_received_data_( - const fastrtps::rtps::CacheChange_t& received_change, + const fastdds::rtps::CacheChange_t& received_change, core::types::RtpsPayloadData& data_to_fill) const noexcept { CommonReader::fill_received_data_(received_change, data_to_fill); diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 733160d6..026eca6d 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -40,10 +40,10 @@ CommonReader::CommonReader( const ParticipantId& participant_id, const DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::ReaderAttributes& reader_attributes, - const fastrtps::TopicAttributes& topic_attributes, + fastdds::rtps::RTPSParticipant* rtps_participant, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::ReaderAttributes& reader_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::ReaderQos& reader_qos) : BaseReader(participant_id, topic.topic_qos.max_rx_rate, topic.topic_qos.downsampling) , rtps_participant_(rtps_participant) @@ -69,7 +69,7 @@ CommonReader::~CommonReader() { // Unset listener before destruction (not necessary in principle, but just in case) rtps_reader_->set_listener(nullptr); - fastrtps::rtps::RTPSDomain::removeRTPSReader(rtps_reader_); + fastdds::rtps::RTPSDomain::removeRTPSReader(rtps_reader_); } // Delete History @@ -92,21 +92,21 @@ void CommonReader::init() } void CommonReader::internal_entities_creation_( - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::ReaderAttributes& reader_attributes, - const fastrtps::TopicAttributes& topic_attributes, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::ReaderAttributes& reader_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::ReaderQos& reader_qos) { // Copy reader attributes because fast needs it non const (do not ask why) - fastrtps::rtps::ReaderAttributes non_const_reader_attributes = reader_attributes; + fastdds::rtps::ReaderAttributes non_const_reader_attributes = reader_attributes; // Create History - rtps_history_ = new fastrtps::rtps::ReaderHistory(history_attributes); + rtps_history_ = new fastdds::rtps::ReaderHistory(history_attributes); // Create CommonReader // Listener must be set in creation as no callbacks should be missed // It is safe to do so here as object is already created and callbacks do not require anything set in this method - rtps_reader_ = fastrtps::rtps::RTPSDomain::createRTPSReader( + rtps_reader_ = fastdds::rtps::RTPSDomain::createRTPSReader( rtps_participant_, non_const_reader_attributes, payload_pool_, @@ -128,7 +128,7 @@ void CommonReader::internal_entities_creation_( if (!rtps_participant_->registerReader(rtps_reader_, topic_attributes, reader_qos)) { // In case it fails, remove reader and throw exception - fastrtps::rtps::RTPSDomain::removeRTPSReader(rtps_reader_); + fastdds::rtps::RTPSDomain::removeRTPSReader(rtps_reader_); throw utils::InitializationException(utils::Formatter() << "Error registering topic " << topic_ << " for Simple RTPSReader in Participant " << participant_id_); } @@ -142,7 +142,7 @@ core::types::Guid CommonReader::guid() const noexcept return rtps_reader_->getGuid(); } -fastrtps::RecursiveTimedMutex& CommonReader::get_rtps_mutex() const noexcept +fastdds::RecursiveTimedMutex& CommonReader::get_rtps_mutex() const noexcept { return rtps_reader_->getMutex(); } @@ -195,13 +195,13 @@ utils::ReturnCode CommonReader::take_nts_( } RtpsPayloadData* CommonReader::create_data_( - const fastrtps::rtps::CacheChange_t& received_change) const noexcept + const fastdds::rtps::CacheChange_t& received_change) const noexcept { return new RtpsPayloadData(); } void CommonReader::fill_received_data_( - const fastrtps::rtps::CacheChange_t& received_change, + const fastdds::rtps::CacheChange_t& received_change, RtpsPayloadData& data_to_fill) const noexcept { // Store the new data that has arrived in the Track data @@ -247,13 +247,13 @@ void CommonReader::enable_nts_() noexcept // However, if the topic is best_effort, the reader will discard the samples received when it was disabled. if (topic_.topic_qos.is_reliable()) { - std::lock_guard lock(get_rtps_mutex()); + std::lock_guard lock(get_rtps_mutex()); on_data_available_(); } } bool CommonReader::should_accept_change_( - const fastrtps::rtps::CacheChange_t* change) noexcept + const fastdds::rtps::CacheChange_t* change) noexcept { // Reject samples sent by a Writer from the same Participant this Reader belongs to if (come_from_this_participant_(change)) @@ -265,23 +265,23 @@ bool CommonReader::should_accept_change_( } bool CommonReader::come_from_this_participant_( - const fastrtps::rtps::CacheChange_t* change) const noexcept + const fastdds::rtps::CacheChange_t* change) const noexcept { return come_from_this_participant_(change->writerGUID); } bool CommonReader::come_from_this_participant_( - const fastrtps::rtps::GUID_t guid) const noexcept + const fastdds::rtps::GUID_t guid) const noexcept { return guid.guidPrefix == rtps_reader_->getGuid().guidPrefix; } -fastrtps::rtps::HistoryAttributes CommonReader::reckon_history_attributes_( +fastdds::rtps::HistoryAttributes CommonReader::reckon_history_attributes_( const core::types::DdsTopic& topic) noexcept { - fastrtps::rtps::HistoryAttributes att; + fastdds::rtps::HistoryAttributes att; att.memoryPolicy = - eprosima::fastrtps::rtps::MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; + eprosima::fastdds::rtps::MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; att.maximumReservedCaches = topic.topic_qos.history_depth; if (att.maximumReservedCaches > 0 && att.initialReservedCaches > att.maximumReservedCaches) @@ -293,10 +293,10 @@ fastrtps::rtps::HistoryAttributes CommonReader::reckon_history_attributes_( return att; } -fastrtps::rtps::ReaderAttributes CommonReader::reckon_reader_attributes_( +fastdds::rtps::ReaderAttributes CommonReader::reckon_reader_attributes_( const core::types::DdsTopic& topic) noexcept { - fastrtps::rtps::ReaderAttributes att; + fastdds::rtps::ReaderAttributes att; // Set Durability att.endpoint.durabilityKind = topic.topic_qos.durability_qos; @@ -307,14 +307,14 @@ fastrtps::rtps::ReaderAttributes CommonReader::reckon_reader_attributes_( // Set if topic has key if (topic.topic_qos.keyed) { - att.endpoint.topicKind = eprosima::fastrtps::rtps::WITH_KEY; + att.endpoint.topicKind = eprosima::fastdds::rtps::WITH_KEY; // If the topic has a key, request inline qos (containing the instance handle) att.expects_inline_qos = true; } else { - att.endpoint.topicKind = eprosima::fastrtps::rtps::NO_KEY; + att.endpoint.topicKind = eprosima::fastdds::rtps::NO_KEY; } // Ownership and Partitions are not part of RTPS, thus they are set in properties @@ -322,19 +322,19 @@ fastrtps::rtps::ReaderAttributes CommonReader::reckon_reader_attributes_( return att; } -fastrtps::TopicAttributes CommonReader::reckon_topic_attributes_( +fastdds::TopicAttributes CommonReader::reckon_topic_attributes_( const core::types::DdsTopic& topic) noexcept { - fastrtps::TopicAttributes att; + fastdds::TopicAttributes att; // Set if topic has key if (topic.topic_qos.keyed) { - att.topicKind = eprosima::fastrtps::rtps::WITH_KEY; + att.topicKind = eprosima::fastdds::rtps::WITH_KEY; } else { - att.topicKind = eprosima::fastrtps::rtps::NO_KEY; + att.topicKind = eprosima::fastdds::rtps::NO_KEY; } // Set Topic attributes @@ -387,8 +387,8 @@ fastdds::dds::ReaderQos CommonReader::reckon_reader_qos_( } void CommonReader::on_new_cache_change_added( - fastrtps::rtps::RTPSReader* reader, - const fastrtps::rtps::CacheChange_t* const change) noexcept + fastdds::rtps::RTPSReader* reader, + const fastdds::rtps::CacheChange_t* const change) noexcept { monitor_msg_rx(topic_, participant_id_); @@ -408,7 +408,7 @@ void CommonReader::on_new_cache_change_added( // Remove received change if the CommonReader is disbled and the topic is not reliable if (!topic_.topic_qos.is_reliable()) { - reader->get_history()->remove_change((fastrtps::rtps::CacheChange_t*)change); + reader->get_history()->remove_change((fastdds::rtps::CacheChange_t*)change); logDebug(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Change removed from history"); } @@ -426,17 +426,17 @@ void CommonReader::on_new_cache_change_added( // WARNING: Removing an unacceptable change here is valid given that Fast-DDS internal reader's mutex is locked. // If the mutex wasn't locked, the track's transmit thread could take an unacceptable sample before it gets // deleted here. - reader->get_history()->remove_change((fastrtps::rtps::CacheChange_t*)change); + reader->get_history()->remove_change((fastdds::rtps::CacheChange_t*)change); } } void CommonReader::on_reader_matched( - fastrtps::rtps::RTPSReader*, - const fastrtps::rtps::MatchingInfo& info) noexcept + fastdds::rtps::RTPSReader*, + const fastdds::rtps::MatchingInfo& info) noexcept { if (!come_from_this_participant_(info.remoteEndpointGuid)) { - if (info.status == fastrtps::rtps::MatchingStatus::MATCHED_MATCHING) + if (info.status == fastdds::rtps::MatchingStatus::MATCHED_MATCHING) { logInfo(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Reader " << *this << " in topic " << topic_.serialize() << " matched with a new Writer with guid " << @@ -452,8 +452,8 @@ void CommonReader::on_reader_matched( } void CommonReader::on_requested_incompatible_qos( - fastrtps::rtps::RTPSReader*, - fastdds::dds::PolicyMask qos) noexcept + fastdds::rtps::RTPSReader*, + eprosima::fastdds::dds::PolicyMask qos) noexcept { logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, "TOPIC_MISMATCH_QOS | Reader " << *this << " found a remote Writer with incompatible QoS: " << @@ -464,7 +464,7 @@ void CommonReader::on_requested_incompatible_qos( } void CommonReader::on_sample_lost( - fastrtps::rtps::RTPSReader*, + fastdds::rtps::RTPSReader*, int32_t sample_lost_since_last_update) noexcept { logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, @@ -474,9 +474,9 @@ void CommonReader::on_sample_lost( } void CommonReader::on_sample_rejected( - fastrtps::rtps::RTPSReader*, + fastdds::rtps::RTPSReader*, eprosima::fastdds::dds::SampleRejectedStatusKind reason, - const fastrtps::rtps::CacheChange_t* const change) noexcept + const fastdds::rtps::CacheChange_t* const change) noexcept { std::string reason_str; switch (reason) @@ -503,7 +503,7 @@ void CommonReader::on_sample_rejected( } void CommonReader::on_incompatible_type( - fastrtps::rtps::RTPSReader* reader) noexcept + fastdds::rtps::RTPSReader* reader) noexcept { logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, "TOPIC_MISMATCH_TYPE | Reader " << *this << @@ -514,10 +514,10 @@ void CommonReader::on_incompatible_type( } utils::ReturnCode CommonReader::is_data_correct_( - const fastrtps::rtps::CacheChange_t* received_change) const noexcept + const fastdds::rtps::CacheChange_t* received_change) const noexcept { // Check that the guid is consistent - if (received_change->writerGUID == fastrtps::rtps::GUID_t::unknown()) + if (received_change->writerGUID == fastdds::rtps::GUID_t::unknown()) { logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data without correct writer GUID."); @@ -529,7 +529,7 @@ utils::ReturnCode CommonReader::is_data_correct_( if (!(received_change->serializedPayload.max_size > 0)) { // Data with 0 bytes is only correct if keyed topic and if data is being disposed - if (!(topic_.topic_qos.keyed && received_change->kind != eprosima::fastrtps::rtps::ChangeKind_t::ALIVE)) + if (!(topic_.topic_qos.keyed && received_change->kind != eprosima::fastdds::rtps::ChangeKind_t::ALIVE)) { logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data with length " << received_change->serializedPayload.length << "."); diff --git a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp index d7318455..b8573dc4 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp @@ -28,7 +28,7 @@ SimpleReader::SimpleReader( const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant) + fastdds::rtps::RTPSParticipant* rtps_participant) : CommonReader( participant_id, topic, payload_pool, rtps_participant, reckon_history_attributes_(topic), diff --git a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp index a7cd3b4f..a79b035b 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp @@ -31,7 +31,7 @@ SpecificQoSReader::SpecificQoSReader( const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const std::shared_ptr& discovery_database) : CommonReader( participant_id, topic, payload_pool, rtps_participant, @@ -44,7 +44,7 @@ SpecificQoSReader::SpecificQoSReader( } void SpecificQoSReader::fill_received_data_( - const fastrtps::rtps::CacheChange_t& received_change, + const fastdds::rtps::CacheChange_t& received_change, core::types::RtpsPayloadData& data_to_fill) const noexcept { CommonReader::fill_received_data_(received_change, data_to_fill); diff --git a/ddspipe_participants/src/cpp/types/address/Address.cpp b/ddspipe_participants/src/cpp/types/address/Address.cpp index db016d0f..245e4aa8 100644 --- a/ddspipe_participants/src/cpp/types/address/Address.cpp +++ b/ddspipe_participants/src/cpp/types/address/Address.cpp @@ -280,13 +280,13 @@ bool Address::operator ==( bool Address::is_ipv4_correct( const IpType& ip) noexcept { - return eprosima::fastrtps::rtps::IPLocator::isIPv4(ip); + return eprosima::fastdds::rtps::IPLocator::isIPv4(ip); } bool Address::is_ipv6_correct( const IpType& ip) noexcept { - return eprosima::fastrtps::rtps::IPLocator::isIPv6(ip); + return eprosima::fastdds::rtps::IPLocator::isIPv6(ip); } PortType Address::default_port() noexcept @@ -328,7 +328,7 @@ IpType Address::resolve_dns( IpVersion ip_version) { std::pair, std::set> dns_response = - fastrtps::rtps::IPLocator::resolveNameDNS(domain); + fastdds::rtps::IPLocator::resolveNameDNS(domain); if (ip_version == IpVersion::v4) { @@ -370,7 +370,7 @@ std::pair Address::resolve_dns( DomainType domain) { std::pair, std::set> dns_response = - fastrtps::rtps::IPLocator::resolveNameDNS(domain); + fastdds::rtps::IPLocator::resolveNameDNS(domain); if (dns_response.first.empty()) { diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index ea84bf52..038fd142 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -52,10 +52,10 @@ TopicDataType::~TopicDataType() } bool TopicDataType::serialize( - void* data, - fastrtps::rtps::SerializedPayload_t* target_payload) + const void* data, + fastdds::rtps::SerializedPayload_t* target_payload) { - DataType* src_payload = static_cast(data); + const DataType* src_payload = static_cast(data); logDebug(DDSPIPE_DDS_TYPESUPPORT, "Serializing data " << *src_payload << "."); @@ -78,7 +78,7 @@ bool TopicDataType::serialize( } bool TopicDataType::deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* src_payload, + eprosima::fastdds::rtps::SerializedPayload_t* src_payload, void* data) { logDebug(DDSPIPE_DDS_TYPESUPPORT, "Deserializing data " << *src_payload << "."); @@ -92,24 +92,24 @@ bool TopicDataType::deserialize( } std::function TopicDataType::getSerializedSizeProvider( - void* data) + const void* data) { return [data]() -> uint32_t { - auto p = static_cast(data); + const auto p = static_cast(data); return p->payload.length; }; } bool TopicDataType::getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* handle, + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t* handle, bool /* = false */) { if (m_isGetKeyDefined) { // Load the instanceHandle from data into handle - auto p = static_cast(data); + const auto p = static_cast(data); *handle = p->instanceHandle; return true; } diff --git a/ddspipe_participants/src/cpp/utils/utils.cpp b/ddspipe_participants/src/cpp/utils/utils.cpp index ffaba6a9..59cc224a 100644 --- a/ddspipe_participants/src/cpp/utils/utils.cpp +++ b/ddspipe_participants/src/cpp/utils/utils.cpp @@ -42,11 +42,11 @@ core::types::Endpoint create_common_endpoint_from_info_( // Reliability if (info.info.m_qos.m_reliability.kind == fastdds::dds::BEST_EFFORT_RELIABILITY_QOS) { - endpoint.topic.topic_qos.reliability_qos.set_value(fastrtps::rtps::BEST_EFFORT); + endpoint.topic.topic_qos.reliability_qos.set_value(fastdds::rtps::BEST_EFFORT); } else if (info.info.m_qos.m_reliability.kind == fastdds::dds::RELIABLE_RELIABILITY_QOS) { - endpoint.topic.topic_qos.reliability_qos.set_value(fastrtps::rtps::RELIABLE); + endpoint.topic.topic_qos.reliability_qos.set_value(fastdds::rtps::RELIABLE); } else { @@ -59,7 +59,7 @@ core::types::Endpoint create_common_endpoint_from_info_( // Set Topic with ownership endpoint.topic.topic_qos.ownership_qos.set_value(info.info.m_qos.m_ownership.kind); // Set Topic key - endpoint.topic.topic_qos.keyed.set_value(info.info.topicKind() == eprosima::fastrtps::rtps::TopicKind_t::WITH_KEY); + endpoint.topic.topic_qos.keyed.set_value(info.info.topicKind() == eprosima::fastdds::rtps::TopicKind_t::WITH_KEY); // Set TypeIdentifier endpoint.topic.type_ids.type_identifier1(info.info.type_information().type_information.complete().typeid_with_size().type_id()); @@ -87,8 +87,8 @@ core::types::Endpoint create_common_endpoint_from_info_( template<> DDSPIPE_PARTICIPANTS_DllAPI -core::types::Endpoint create_endpoint_from_info_( - const fastrtps::rtps::WriterDiscoveryInfo& info, +core::types::Endpoint create_endpoint_from_info_( + const fastdds::rtps::WriterDiscoveryInfo& info, const core::types::ParticipantId participant_discoverer_id) { // Create Endpoint from common info @@ -108,8 +108,8 @@ core::types::Endpoint create_endpoint_from_info_ DDSPIPE_PARTICIPANTS_DllAPI -core::types::Endpoint create_endpoint_from_info_( - const fastrtps::rtps::ReaderDiscoveryInfo& info, +core::types::Endpoint create_endpoint_from_info_( + const fastdds::rtps::ReaderDiscoveryInfo& info, const core::types::ParticipantId participant_discoverer_id) { // Create Endpoint from common info @@ -129,16 +129,16 @@ core::types::SpecificEndpointQoS specific_qos_of_writer_( } bool come_from_same_participant_( - const fastrtps::rtps::GUID_t src_guid, - const fastrtps::rtps::GUID_t target_guid) noexcept + const fastdds::rtps::GUID_t src_guid, + const fastdds::rtps::GUID_t target_guid) noexcept { return src_guid.guidPrefix == target_guid.guidPrefix; } -fastrtps::rtps::GUID_t guid_from_instance_handle( - const fastrtps::rtps::InstanceHandle_t& ihandle) noexcept +fastdds::rtps::GUID_t guid_from_instance_handle( + const fastdds::rtps::InstanceHandle_t& ihandle) noexcept { - return fastrtps::rtps::iHandle2GUID(ihandle); + return fastdds::rtps::iHandle2GUID(ihandle); } } /* namespace detail */ diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index 37c3b481..76b4fe69 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -173,7 +173,7 @@ fastdds::dds::DataWriterQos CommonWriter::reckon_writer_qos_() const noexcept } // Set minimum deadline so it matches with everything - qos.deadline().period = eprosima::fastrtps::Duration_t(0); + qos.deadline().period = eprosima::fastdds::Duration_t(0); return qos; } diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index cfaca2f1..3a8bb239 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -37,7 +37,7 @@ SimpleWriter::SimpleWriter( const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater /* = false */) : CommonWriter( participant_id, topic, payload_pool, rtps_participant, repeater, @@ -51,8 +51,8 @@ SimpleWriter::SimpleWriter( } utils::ReturnCode SimpleWriter::fill_to_send_data_( - fastrtps::rtps::CacheChange_t* to_send_change_to_fill, - eprosima::fastrtps::rtps::WriteParams& to_send_params, + fastdds::rtps::CacheChange_t* to_send_change_to_fill, + eprosima::fastdds::rtps::WriteParams& to_send_params, const core::types::RtpsPayloadData& data) const noexcept { CommonWriter::fill_to_send_data_( @@ -70,7 +70,7 @@ utils::ReturnCode SimpleWriter::fill_to_send_data_( } void SimpleWriter::fill_sent_data_( - const eprosima::fastrtps::rtps::WriteParams& sent_params, + const eprosima::fastdds::rtps::WriteParams& sent_params, core::types::RtpsPayloadData& data_to_fill) const noexcept { CommonWriter::fill_sent_data_( diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 2fb0a508..b22fe481 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -42,11 +42,11 @@ CommonWriter::CommonWriter( const ParticipantId& participant_id, const DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater, - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::WriterAttributes& writer_attributes, - const fastrtps::TopicAttributes& topic_attributes, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::WriterAttributes& writer_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration) : BaseWriter(participant_id, topic.topic_qos.max_tx_rate) @@ -82,7 +82,7 @@ CommonWriter::~CommonWriter() } // Delete the CommonWriter the History is cleaned - fastrtps::rtps::RTPSDomain::removeRTPSWriter(rtps_writer_); + fastdds::rtps::RTPSDomain::removeRTPSWriter(rtps_writer_); } // Delete History @@ -106,12 +106,12 @@ void CommonWriter::init() } void CommonWriter::onWriterMatched( - fastrtps::rtps::RTPSWriter*, - fastrtps::rtps::MatchingInfo& info) noexcept + fastdds::rtps::RTPSWriter*, + fastdds::rtps::MatchingInfo& info) noexcept { if (!come_from_this_participant_(info.remoteEndpointGuid)) { - if (info.status == fastrtps::rtps::MatchingStatus::MATCHED_MATCHING) + if (info.status == fastdds::rtps::MatchingStatus::MATCHED_MATCHING) { logInfo(DDSPIPE_RTPS_COMMONWRITER_LISTENER, "Writer " << *this << " in topic " << topic_.serialize() << " matched with a new Reader with guid " << @@ -127,8 +127,8 @@ void CommonWriter::onWriterMatched( } void CommonWriter::onWriterChangeReceivedByAll( - fastrtps::rtps::RTPSWriter* /*writer*/, - fastrtps::rtps::CacheChange_t* change) + fastdds::rtps::RTPSWriter* /*writer*/, + fastdds::rtps::CacheChange_t* change) { if (writer_qos_.m_reliability.kind == fastdds::dds::BEST_EFFORT_RELIABILITY_QOS || writer_qos_.m_durability.kind == fastdds::dds::VOLATILE_DURABILITY_QOS) @@ -138,8 +138,8 @@ void CommonWriter::onWriterChangeReceivedByAll( } void CommonWriter::on_offered_incompatible_qos( - fastrtps::rtps::RTPSWriter*, - fastdds::dds::PolicyMask qos) noexcept + fastdds::rtps::RTPSWriter*, + eprosima::fastdds::dds::PolicyMask qos) noexcept { logWarning(DDSPIPE_RTPS_COMMONWRITER_LISTENER, "Writer " << *this << " found a remote Reader with incompatible QoS: " << @@ -147,7 +147,7 @@ void CommonWriter::on_offered_incompatible_qos( } bool CommonWriter::come_from_this_participant_( - const fastrtps::rtps::GUID_t guid) const noexcept + const fastdds::rtps::GUID_t guid) const noexcept { return guid.guidPrefix == rtps_writer_->getGuid().guidPrefix; } @@ -166,7 +166,7 @@ utils::ReturnCode CommonWriter::write_nts_( } // Take new Change from history - fastrtps::rtps::CacheChange_t* new_change; + fastdds::rtps::CacheChange_t* new_change; if (topic_.topic_qos.keyed) { @@ -190,7 +190,7 @@ utils::ReturnCode CommonWriter::write_nts_( rtps_data.source_guid); // Get params to write (if set) - eprosima::fastrtps::rtps::WriteParams write_params; + eprosima::fastdds::rtps::WriteParams write_params; // Fill cache change with specific data to send auto ret = fill_to_send_data_(new_change, write_params, rtps_data); @@ -212,8 +212,8 @@ utils::ReturnCode CommonWriter::write_nts_( } utils::ReturnCode CommonWriter::fill_to_send_data_( - fastrtps::rtps::CacheChange_t* to_send_change_to_fill, - eprosima::fastrtps::rtps::WriteParams& to_send_params, + fastdds::rtps::CacheChange_t* to_send_change_to_fill, + eprosima::fastdds::rtps::WriteParams& to_send_params, const RtpsPayloadData& data) const noexcept { if (repeater_) @@ -234,7 +234,7 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( if (data.payload.length > 0) { if (!payload_pool_->get_payload( - const_cast(data.payload), + const_cast(data.payload), (to_send_change_to_fill->serializedPayload))) { logDevError(DDSPIPE_RTPS_COMMONWRITER, "Error getting Payload."); @@ -252,24 +252,24 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( } void CommonWriter::fill_sent_data_( - const eprosima::fastrtps::rtps::WriteParams& params, + const eprosima::fastdds::rtps::WriteParams& params, core::types::RtpsPayloadData& data_to_fill) const noexcept { // Do nothing } void CommonWriter::internal_entities_creation_( - const fastrtps::rtps::HistoryAttributes& history_attributes, - const fastrtps::rtps::WriterAttributes& writer_attributes, - const fastrtps::TopicAttributes& topic_attributes, + const fastdds::rtps::HistoryAttributes& history_attributes, + const fastdds::rtps::WriterAttributes& writer_attributes, + const fastdds::TopicAttributes& topic_attributes, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration) { // Copy writer attributes because fast needs it non const (do not ask why) - fastrtps::rtps::WriterAttributes non_const_writer_attributes = writer_attributes; + fastdds::rtps::WriterAttributes non_const_writer_attributes = writer_attributes; // Create History - rtps_history_ = new fastrtps::rtps::WriterHistory(history_attributes); + rtps_history_ = new fastdds::rtps::WriterHistory(history_attributes); // Create CommonWriter // Listener must be set in creation as no callbacks should be missed @@ -278,7 +278,7 @@ void CommonWriter::internal_entities_creation_( { logDebug(DDSPIPE_RTPS_COMMONWRITER, "CommonWriter created with repeater filter"); - rtps_writer_ = fastrtps::rtps::RTPSDomain::createRTPSWriter( + rtps_writer_ = fastdds::rtps::RTPSDomain::createRTPSWriter( rtps_participant_, non_const_writer_attributes, payload_pool_, @@ -288,7 +288,7 @@ void CommonWriter::internal_entities_creation_( } else { - rtps_writer_ = fastrtps::rtps::RTPSDomain::createRTPSWriter( + rtps_writer_ = fastdds::rtps::RTPSDomain::createRTPSWriter( rtps_participant_, non_const_writer_attributes, payload_pool_, @@ -307,7 +307,7 @@ void CommonWriter::internal_entities_creation_( if (!rtps_participant_->registerWriter(rtps_writer_, topic_attributes, writer_qos)) { // In case it fails, remove writer and throw exception - fastrtps::rtps::RTPSDomain::removeRTPSWriter(rtps_writer_); + fastdds::rtps::RTPSDomain::removeRTPSWriter(rtps_writer_); throw utils::InitializationException(utils::Formatter() << "Error registering topic " << topic_ << " for Simple RTPSWriter in Participant " << participant_id_); } @@ -332,13 +332,13 @@ void CommonWriter::internal_entities_creation_( " with guid " << rtps_writer_->getGuid()); } -fastrtps::rtps::HistoryAttributes CommonWriter::reckon_history_attributes_( +fastdds::rtps::HistoryAttributes CommonWriter::reckon_history_attributes_( const core::types::DdsTopic& topic) noexcept { - fastrtps::rtps::HistoryAttributes att; + fastdds::rtps::HistoryAttributes att; att.memoryPolicy = - eprosima::fastrtps::rtps::MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; + eprosima::fastdds::rtps::MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; att.maximumReservedCaches = topic.topic_qos.history_depth; if (att.maximumReservedCaches > 0 && att.initialReservedCaches > att.maximumReservedCaches) @@ -350,10 +350,10 @@ fastrtps::rtps::HistoryAttributes CommonWriter::reckon_history_attributes_( return att; } -fastrtps::rtps::WriterAttributes CommonWriter::reckon_writer_attributes_( +fastdds::rtps::WriterAttributes CommonWriter::reckon_writer_attributes_( const core::types::DdsTopic& topic) noexcept { - fastrtps::rtps::WriterAttributes att; + fastdds::rtps::WriterAttributes att; // Set Durability att.endpoint.durabilityKind = topic.topic_qos.durability_qos; @@ -364,35 +364,35 @@ fastrtps::rtps::WriterAttributes CommonWriter::reckon_writer_attributes_( // Set if topic has key if (topic.topic_qos.keyed) { - att.endpoint.topicKind = eprosima::fastrtps::rtps::WITH_KEY; + att.endpoint.topicKind = eprosima::fastdds::rtps::WITH_KEY; } else { - att.endpoint.topicKind = eprosima::fastrtps::rtps::NO_KEY; + att.endpoint.topicKind = eprosima::fastdds::rtps::NO_KEY; } // Other attributes as partitions and ownership are not used in this writer // Set write mode // ATTENTION: Changing this will change the logic of removing changes added. Please be careful. - att.mode = fastrtps::rtps::RTPSWriterPublishMode::SYNCHRONOUS_WRITER; + att.mode = fastdds::rtps::RTPSWriterPublishMode::SYNCHRONOUS_WRITER; return att; } -fastrtps::TopicAttributes CommonWriter::reckon_topic_attributes_( +fastdds::TopicAttributes CommonWriter::reckon_topic_attributes_( const core::types::DdsTopic& topic) noexcept { - fastrtps::TopicAttributes att; + fastdds::TopicAttributes att; // Set if topic has key if (topic.topic_qos.keyed) { - att.topicKind = eprosima::fastrtps::rtps::WITH_KEY; + att.topicKind = eprosima::fastdds::rtps::WITH_KEY; } else { - att.topicKind = eprosima::fastrtps::rtps::NO_KEY; + att.topicKind = eprosima::fastdds::rtps::NO_KEY; } // Set Topic attributes @@ -429,7 +429,7 @@ fastdds::dds::WriterQos CommonWriter::reckon_writer_qos_( : eprosima::fastdds::dds::ReliabilityQosPolicyKind::BEST_EFFORT_RELIABILITY_QOS); // Set minimum deadline so it matches with everything - qos.m_deadline.period = eprosima::fastrtps::Duration_t(0); + qos.m_deadline.period = eprosima::fastdds::Duration_t(0); // Partitions and specific ownership strength are not set in common. diff --git a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp index e3226924..296570e5 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp @@ -39,7 +39,7 @@ MultiWriter::MultiWriter( const ParticipantId& participant_id, const DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater /* = false */) : BaseWriter(participant_id) , payload_pool_(payload_pool) diff --git a/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp index de959650..949f08ab 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp @@ -26,7 +26,7 @@ QoSSpecificWriter::QoSSpecificWriter( const ParticipantId& participant_id, const DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const SpecificEndpointQoS& specific_qos, const bool repeater /* = false */) : CommonWriter( diff --git a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp index 8cf99c39..14bbc374 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp @@ -35,7 +35,7 @@ SimpleWriter::SimpleWriter( const core::types::ParticipantId& participant_id, const core::types::DdsTopic& topic, const std::shared_ptr& payload_pool, - fastrtps::rtps::RTPSParticipant* rtps_participant, + fastdds::rtps::RTPSParticipant* rtps_participant, const bool repeater /* = false */) : CommonWriter( participant_id, topic, payload_pool, rtps_participant, repeater, diff --git a/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp b/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp index 0428db44..e7e3d85d 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp @@ -26,8 +26,8 @@ namespace participants { namespace rtps { bool RepeaterDataFilter::is_relevant( - const fastrtps::rtps::CacheChange_t& change, - const fastrtps::rtps::GUID_t& reader_guid) const + const fastdds::rtps::CacheChange_t& change, + const fastdds::rtps::GUID_t& reader_guid) const { if (!SelfDataFilter::is_relevant(change, reader_guid)) { diff --git a/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp b/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp index 004e3ba3..2939942f 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp @@ -26,8 +26,8 @@ namespace participants { namespace rtps { bool SelfDataFilter::is_relevant( - const fastrtps::rtps::CacheChange_t& change, - const fastrtps::rtps::GUID_t& reader_guid) const + const fastdds::rtps::CacheChange_t& change, + const fastdds::rtps::GUID_t& reader_guid) const { // It is relevant only if the reader does not belong to same participant as writer return change.writerGUID.guidPrefix != reader_guid.guidPrefix; From 1648698a4e449cb6abdb5a9b81bc34efbe27ec6a Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Wed, 3 Jul 2024 12:54:33 +0200 Subject: [PATCH 12/53] Change .h headers to .hpp and regenerate types Signed-off-by: Lucia Echevarria --- .../communication/rpc/ServiceRegistry.hpp | 2 +- .../efficiency/payload/PayloadPool.hpp | 6 +-- .../payload/PayloadPoolMediator.hpp | 6 +-- .../ddspipe_core/logging/DdsLogConsumer.hpp | 2 +- .../producers/StatusMonitorProducer.hpp | 2 +- .../producers/TopicsMonitorProducer.hpp | 2 +- .../types/data/RpcPayloadData.hpp | 4 +- .../types/data/RtpsPayloadData.hpp | 4 +- .../include/ddspipe_core/types/dds/Guid.hpp | 2 +- .../ddspipe_core/types/dds/GuidPrefix.hpp | 2 +- .../ddspipe_core/types/dds/Payload.hpp | 12 +++--- .../types/dds/SpecificEndpointQoS.hpp | 4 +- .../ddspipe_core/types/dds/TopicQoS.hpp | 2 +- .../ddspipe_core/types/logging/LogEntry.hpp | 4 +- .../types/logging/LogEntryCdrAux.hpp | 6 +-- .../types/logging/LogEntryCdrAux.ipp | 6 +-- ...yPubSubTypes.h => LogEntryPubSubTypes.hpp} | 18 ++++----- .../logging/LogEntryTypeObjectSupport.hpp | 6 +-- .../monitoring/status/MonitoringStatus.hpp | 4 +- .../status/MonitoringStatusCdrAux.hpp | 6 +-- .../status/MonitoringStatusCdrAux.ipp | 6 +-- ...ypes.h => MonitoringStatusPubSubTypes.hpp} | 22 +++++------ .../MonitoringStatusTypeObjectSupport.hpp | 6 +-- .../monitoring/topics/MonitoringTopics.hpp | 4 +- .../topics/MonitoringTopicsCdrAux.hpp | 6 +-- .../topics/MonitoringTopicsCdrAux.ipp | 6 +-- ...ypes.h => MonitoringTopicsPubSubTypes.hpp} | 26 ++++++------- .../MonitoringTopicsTypeObjectSupport.hpp | 6 +-- ddspipe_core/src/cpp/monitoring/Monitor.cpp | 4 +- .../cpp/types/logging/LogEntryPubSubTypes.cxx | 2 +- .../status/MonitoringStatusPubSubTypes.cxx | 2 +- .../topics/MonitoringTopicsPubSubTypes.cxx | 2 +- .../efficiency/FastPayloadPoolTest.cpp | 2 +- .../efficiency/MapPayloadPoolTest.cpp | 2 +- .../unittest/efficiency/PayloadPoolTest.cpp | 4 +- .../test/unittest/logging/constants.hpp | 2 +- .../dds_consumer/DdsLogConsumerTest.cpp | 2 +- .../test/unittest/monitoring/constants.hpp | 2 +- .../status/dds/DdsMonitorStatusTest.cpp | 2 +- .../topics/dds/DdsMonitorTopicsTest.cpp | 2 +- .../types/dynamic_types/types/all_types.hpp | 22 +++++------ .../type_objects/arrays_and_sequences.hpp | 4 +- .../arrays_and_sequencesCdrAux.hpp | 6 +-- .../arrays_and_sequencesCdrAux.ipp | 6 +-- .../arrays_and_sequencesPubSubTypes.cxx | 2 +- ....h => arrays_and_sequencesPubSubTypes.hpp} | 22 +++++------ .../arrays_and_sequencesTypeObjectSupport.hpp | 6 +-- .../types/type_objects/basic_array_struct.hpp | 4 +- .../type_objects/basic_array_structCdrAux.hpp | 6 +-- .../type_objects/basic_array_structCdrAux.ipp | 6 +-- .../basic_array_structPubSubTypes.cxx | 2 +- ...es.h => basic_array_structPubSubTypes.hpp} | 22 +++++------ .../basic_array_structTypeObjectSupport.hpp | 6 +-- .../types/type_objects/basic_struct.hpp | 4 +- .../types/type_objects/basic_structCdrAux.hpp | 6 +-- .../types/type_objects/basic_structCdrAux.ipp | 6 +-- .../type_objects/basic_structPubSubTypes.cxx | 2 +- ...SubTypes.h => basic_structPubSubTypes.hpp} | 22 +++++------ .../basic_structTypeObjectSupport.hpp | 6 +-- .../types/type_objects/char_sequence.hpp | 4 +- .../type_objects/char_sequenceCdrAux.hpp | 6 +-- .../type_objects/char_sequenceCdrAux.ipp | 6 +-- .../type_objects/char_sequencePubSubTypes.cxx | 2 +- ...ubTypes.h => char_sequencePubSubTypes.hpp} | 18 ++++----- .../char_sequenceTypeObjectSupport.hpp | 6 +-- .../type_objects/complex_nested_arrays.hpp | 4 +- .../complex_nested_arraysCdrAux.hpp | 6 +-- .../complex_nested_arraysCdrAux.ipp | 6 +-- .../complex_nested_arraysPubSubTypes.cxx | 2 +- ...h => complex_nested_arraysPubSubTypes.hpp} | 30 +++++++-------- ...complex_nested_arraysTypeObjectSupport.hpp | 6 +-- .../types/type_objects/enum_struct.hpp | 4 +- .../types/type_objects/enum_structCdrAux.hpp | 6 +-- .../types/type_objects/enum_structCdrAux.ipp | 6 +-- .../type_objects/enum_structPubSubTypes.cxx | 2 +- ...bSubTypes.h => enum_structPubSubTypes.hpp} | 18 ++++----- .../enum_structTypeObjectSupport.hpp | 6 +-- .../type_objects/float_bounded_sequence.hpp | 4 +- .../float_bounded_sequenceCdrAux.hpp | 6 +-- .../float_bounded_sequenceCdrAux.ipp | 6 +-- .../float_bounded_sequencePubSubTypes.cxx | 2 +- ... => float_bounded_sequencePubSubTypes.hpp} | 18 ++++----- ...loat_bounded_sequenceTypeObjectSupport.hpp | 6 +-- .../types/type_objects/hello_world.hpp | 4 +- .../types/type_objects/hello_worldCdrAux.hpp | 6 +-- .../types/type_objects/hello_worldCdrAux.ipp | 6 +-- .../type_objects/hello_worldPubSubTypes.cxx | 2 +- ...bSubTypes.h => hello_worldPubSubTypes.hpp} | 18 ++++----- .../hello_worldTypeObjectSupport.hpp | 6 +-- .../types/type_objects/map_struct.hpp | 4 +- .../types/type_objects/map_structCdrAux.hpp | 6 +-- .../types/type_objects/map_structCdrAux.ipp | 6 +-- .../type_objects/map_structPubSubTypes.cxx | 2 +- ...ubSubTypes.h => map_structPubSubTypes.hpp} | 18 ++++----- .../map_structTypeObjectSupport.hpp | 6 +-- .../types/type_objects/numeric_array.hpp | 4 +- .../type_objects/numeric_arrayCdrAux.hpp | 6 +-- .../type_objects/numeric_arrayCdrAux.ipp | 6 +-- .../type_objects/numeric_arrayPubSubTypes.cxx | 2 +- ...ubTypes.h => numeric_arrayPubSubTypes.hpp} | 18 ++++----- .../numeric_arrayTypeObjectSupport.hpp | 6 +-- .../types/type_objects/union_struct.hpp | 4 +- .../types/type_objects/union_structCdrAux.hpp | 6 +-- .../types/type_objects/union_structCdrAux.ipp | 6 +-- .../type_objects/union_structPubSubTypes.cxx | 2 +- ...SubTypes.h => union_structPubSubTypes.hpp} | 18 ++++----- .../union_structTypeObjectSupport.hpp | 6 +-- .../test/unittest/types/endpoint/GuidTest.cpp | 2 +- .../cache_change/CacheChangePool.hpp | 3 +- .../dynamic_types/DynTypesParticipant.hpp | 6 +-- .../participant/rtps/CommonParticipant.hpp | 12 +++--- .../rtps/DiscoveryServerParticipant.hpp | 2 +- .../rtps/InitialPeersParticipant.hpp | 2 +- .../reader/rtps/CommonReader.hpp | 12 +++--- .../types/address/Address.hpp | 2 +- .../types/dds/RouterCacheChange.hpp | 2 +- .../types/dds/TopicDataType.hpp | 2 +- .../types/security/tls/TlsConfiguration.hpp | 2 +- .../ddspipe_participants/utils/utils.hpp | 6 +-- .../writer/rpc/SimpleWriter.hpp | 10 ++--- .../writer/rtps/CommonWriter.hpp | 18 ++++----- .../writer/rtps/QoSSpecificWriter.hpp | 2 +- .../writer/rtps/SimpleWriter.hpp | 10 ++--- .../dynamic_types/DynTypesParticipant.cpp | 38 +++++++++++-------- .../participant/rtps/CommonParticipant.cpp | 12 +++--- .../rtps/DiscoveryServerParticipant.cpp | 8 ++-- .../rtps/InitialPeersParticipant.cpp | 8 ++-- .../participant/rtps/SimpleParticipant.cpp | 10 ++--- .../src/cpp/reader/dds/SimpleReader.cpp | 4 +- .../src/cpp/reader/dds/SpecificQoSReader.cpp | 4 +- .../src/cpp/reader/rpc/SimpleReader.cpp | 4 +- .../src/cpp/reader/rtps/CommonReader.cpp | 4 +- .../src/cpp/reader/rtps/SimpleReader.cpp | 4 +- .../src/cpp/reader/rtps/SpecificQoSReader.cpp | 4 +- .../src/cpp/types/address/Address.cpp | 2 +- .../src/cpp/writer/dds/CommonWriter.cpp | 6 +-- .../src/cpp/writer/dds/MultiWriter.cpp | 6 +-- .../src/cpp/writer/dds/SimpleWriter.cpp | 6 +-- .../src/cpp/writer/rpc/SimpleWriter.cpp | 6 +-- .../src/cpp/writer/rtps/CommonWriter.cpp | 6 +-- .../src/cpp/writer/rtps/MultiWriter.cpp | 6 +-- .../src/cpp/writer/rtps/SimpleWriter.cpp | 6 +-- .../writer/rtps/filter/RepeaterDataFilter.cpp | 4 +- .../cpp/writer/rtps/filter/SelfDataFilter.cpp | 4 +- 144 files changed, 484 insertions(+), 479 deletions(-) rename ddspipe_core/include/ddspipe_core/types/logging/{LogEntryPubSubTypes.h => LogEntryPubSubTypes.hpp} (89%) rename ddspipe_core/include/ddspipe_core/types/monitoring/status/{MonitoringStatusPubSubTypes.h => MonitoringStatusPubSubTypes.hpp} (91%) rename ddspipe_core/include/ddspipe_core/types/monitoring/topics/{MonitoringTopicsPubSubTypes.h => MonitoringTopicsPubSubTypes.hpp} (92%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{arrays_and_sequencesPubSubTypes.h => arrays_and_sequencesPubSubTypes.hpp} (91%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{basic_array_structPubSubTypes.h => basic_array_structPubSubTypes.hpp} (91%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{basic_structPubSubTypes.h => basic_structPubSubTypes.hpp} (91%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{char_sequencePubSubTypes.h => char_sequencePubSubTypes.hpp} (89%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{complex_nested_arraysPubSubTypes.h => complex_nested_arraysPubSubTypes.hpp} (93%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{enum_structPubSubTypes.h => enum_structPubSubTypes.hpp} (89%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{float_bounded_sequencePubSubTypes.h => float_bounded_sequencePubSubTypes.hpp} (88%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{hello_worldPubSubTypes.h => hello_worldPubSubTypes.hpp} (89%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{map_structPubSubTypes.h => map_structPubSubTypes.hpp} (89%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{numeric_arrayPubSubTypes.h => numeric_arrayPubSubTypes.hpp} (89%) rename ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/{union_structPubSubTypes.h => union_structPubSubTypes.hpp} (89%) diff --git a/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp b/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp index 686cdba5..3a55d85c 100644 --- a/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp +++ b/ddspipe_core/include/ddspipe_core/communication/rpc/ServiceRegistry.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp index a68c1629..5c421262 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp @@ -16,9 +16,9 @@ #include -#include -#include -#include +#include +#include +#include #include diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp index ee6cbb8a..bb2b1c01 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp @@ -21,9 +21,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp b/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp index a5c416cf..610f14b2 100644 --- a/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp +++ b/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include namespace eprosima { diff --git a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp index f17c3d1a..fa2e7230 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp +++ b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include // DDSPIPE MONITOR MACROS diff --git a/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp b/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp index c2a740ed..fb396a91 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp +++ b/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include diff --git a/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp b/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp index 3f385577..ad661066 100644 --- a/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp +++ b/ddspipe_core/include/ddspipe_core/types/data/RpcPayloadData.hpp @@ -15,8 +15,8 @@ #pragma once -#include -#include +#include +#include #include diff --git a/ddspipe_core/include/ddspipe_core/types/data/RtpsPayloadData.hpp b/ddspipe_core/include/ddspipe_core/types/data/RtpsPayloadData.hpp index dea8eede..47c7ff3f 100644 --- a/ddspipe_core/include/ddspipe_core/types/data/RtpsPayloadData.hpp +++ b/ddspipe_core/include/ddspipe_core/types/data/RtpsPayloadData.hpp @@ -15,8 +15,8 @@ #pragma once -#include -#include +#include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp index 287ecef5..d6e41249 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Guid.hpp @@ -14,7 +14,7 @@ #pragma once -#include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp index aa7444cb..f8e93dd1 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp @@ -14,7 +14,7 @@ #pragma once -#include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp index 917d7918..66126b56 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp @@ -17,12 +17,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp b/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp index 793aaa10..483ecc94 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp @@ -15,8 +15,8 @@ #pragma once #include -#include -#include +#include +#include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp index bc28f59c..1ff55ce9 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp index d94694e8..f916c76b 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntry.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_LOGENTRY_HPP_ -#define _FAST_DDS_GENERATED_LOGENTRY_HPP_ +#ifndef FAST_DDS_GENERATED__LOGENTRY_HPP +#define FAST_DDS_GENERATED__LOGENTRY_HPP #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.hpp index 7ad98a12..51af1ab7 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.hpp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__LOGENTRYCDRAUX_HPP +#define FAST_DDS_GENERATED__LOGENTRYCDRAUX_HPP #include "LogEntry.hpp" @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_LOGENTRYCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__LOGENTRYCDRAUX_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp index ef467901..850ff708 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_LOGENTRYCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_LOGENTRYCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__LOGENTRYCDRAUX_IPP +#define FAST_DDS_GENERATED__LOGENTRYCDRAUX_IPP #include "LogEntryCdrAux.hpp" @@ -152,5 +152,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_LOGENTRYCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__LOGENTRYCDRAUX_IPP diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.hpp similarity index 89% rename from ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h rename to ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.hpp index 7400674b..b9c0ba03 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file LogEntryPubSubTypes.h + * @file LogEntryPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_LOGENTRY_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_LOGENTRY_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__LOGENTRY_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__LOGENTRY_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "LogEntry.hpp" @@ -106,7 +106,7 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_LOGENTRY_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__LOGENTRY_PUBSUBTYPES_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp index 674f83ef..7e321396 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__LOGENTRY_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__LOGENTRY_TYPE_OBJECT_SUPPORT_HPP #include @@ -65,4 +65,4 @@ eProsima_user_DllExport void register_LogEntry_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_LOGENTRY_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__LOGENTRY_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatus.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatus.hpp index a39cb6ab..4a7b6f14 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatus.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatus.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_HPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGSTATUS_HPP +#define FAST_DDS_GENERATED__MONITORINGSTATUS_HPP #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.hpp index 7293b9d0..019e6148 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGSTATUSCDRAUX_HPP +#define FAST_DDS_GENERATED__MONITORINGSTATUSCDRAUX_HPP #include "MonitoringStatus.hpp" @@ -49,5 +49,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__MONITORINGSTATUSCDRAUX_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp index 01e01b1f..b5d3bd7f 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGSTATUSCDRAUX_IPP +#define FAST_DDS_GENERATED__MONITORINGSTATUSCDRAUX_IPP #include "MonitoringStatusCdrAux.hpp" @@ -206,5 +206,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUSCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__MONITORINGSTATUSCDRAUX_IPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.hpp similarity index 91% rename from ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h rename to ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.hpp index 6e7b6f06..f9312894 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file MonitoringStatusPubSubTypes.h + * @file MonitoringStatusPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__MONITORINGSTATUS_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__MONITORINGSTATUS_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "MonitoringStatus.hpp" @@ -106,7 +106,7 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,7 +124,7 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -197,7 +197,7 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -215,10 +215,10 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__MONITORINGSTATUS_PUBSUBTYPES_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp index 5b511d90..cfd3150c 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP #include @@ -65,4 +65,4 @@ eProsima_user_DllExport void register_MonitoringStatus_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__MONITORINGSTATUS_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopics.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopics.hpp index ecae6507..e20c5f27 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopics.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopics.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_HPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGTOPICS_HPP +#define FAST_DDS_GENERATED__MONITORINGTOPICS_HPP #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.hpp index 6f49032a..78583c88 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGTOPICSCDRAUX_HPP +#define FAST_DDS_GENERATED__MONITORINGTOPICSCDRAUX_HPP #include "MonitoringTopics.hpp" @@ -56,5 +56,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__MONITORINGTOPICSCDRAUX_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp index 601b3db0..d617bd3a 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGTOPICSCDRAUX_IPP +#define FAST_DDS_GENERATED__MONITORINGTOPICSCDRAUX_IPP #include "MonitoringTopicsCdrAux.hpp" @@ -330,5 +330,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICSCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__MONITORINGTOPICSCDRAUX_IPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.hpp similarity index 92% rename from ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h rename to ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.hpp index eb28460c..5defce7f 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.h +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file MonitoringTopicsPubSubTypes.h + * @file MonitoringTopicsPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__MONITORINGTOPICS_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__MONITORINGTOPICS_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "MonitoringTopics.hpp" @@ -106,7 +106,7 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,7 +124,7 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -197,7 +197,7 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -215,7 +215,7 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -288,7 +288,7 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -306,10 +306,10 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__MONITORINGTOPICS_PUBSUBTYPES_HPP diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp index add655a1..9398dc0f 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP #include @@ -77,4 +77,4 @@ eProsima_user_DllExport void register_MonitoringTopics_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__MONITORINGTOPICS_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/src/cpp/monitoring/Monitor.cpp b/ddspipe_core/src/cpp/monitoring/Monitor.cpp index d0d632e0..47ccb02a 100644 --- a/ddspipe_core/src/cpp/monitoring/Monitor.cpp +++ b/ddspipe_core/src/cpp/monitoring/Monitor.cpp @@ -23,9 +23,9 @@ #include #include -#include +#include #include -#include +#include namespace eprosima { namespace ddspipe { diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx index 126f5428..ae42b282 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include +#include #include #include diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx index 1233bb03..2db9a4c4 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include +#include #include #include diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx index 8adc0a99..940946e1 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include +#include #include #include diff --git a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp index ab5f5c88..168fbacf 100644 --- a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp index 244e2be3..3739b0ee 100644 --- a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp index 74da3f62..55cbbadb 100644 --- a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp @@ -16,8 +16,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/ddspipe_core/test/unittest/logging/constants.hpp b/ddspipe_core/test/unittest/logging/constants.hpp index 8ac96741..512427df 100644 --- a/ddspipe_core/test/unittest/logging/constants.hpp +++ b/ddspipe_core/test/unittest/logging/constants.hpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp index d6d8acc0..cd918482 100644 --- a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp +++ b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include "../constants.hpp" diff --git a/ddspipe_core/test/unittest/monitoring/constants.hpp b/ddspipe_core/test/unittest/monitoring/constants.hpp index d8658a55..2645f950 100644 --- a/ddspipe_core/test/unittest/monitoring/constants.hpp +++ b/ddspipe_core/test/unittest/monitoring/constants.hpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp b/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp index 357ca0cb..8add043b 100644 --- a/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp +++ b/ddspipe_core/test/unittest/monitoring/status/dds/DdsMonitorStatusTest.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include "../../constants.hpp" diff --git a/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp b/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp index beb4dcd2..24e16e8d 100644 --- a/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp +++ b/ddspipe_core/test/unittest/monitoring/topics/dds/DdsMonitorTopicsTest.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include "../../constants.hpp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp index 6c93ae75..98eba88b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp @@ -37,37 +37,37 @@ #include #include "type_objects/arrays_and_sequences.hpp" -#include "type_objects/arrays_and_sequencesPubSubTypes.h" +#include "type_objects/arrays_and_sequencesPubSubTypes.hpp" #include "type_objects/basic_array_struct.hpp" -#include "type_objects/basic_array_structPubSubTypes.h" +#include "type_objects/basic_array_structPubSubTypes.hpp" #include "type_objects/basic_struct.hpp" -#include "type_objects/basic_structPubSubTypes.h" +#include "type_objects/basic_structPubSubTypes.hpp" #include "type_objects/char_sequence.hpp" -#include "type_objects/char_sequencePubSubTypes.h" +#include "type_objects/char_sequencePubSubTypes.hpp" #include "type_objects/complex_nested_arrays.hpp" -#include "type_objects/complex_nested_arraysPubSubTypes.h" +#include "type_objects/complex_nested_arraysPubSubTypes.hpp" #include "type_objects/enum_struct.hpp" -#include "type_objects/enum_structPubSubTypes.h" +#include "type_objects/enum_structPubSubTypes.hpp" #include "type_objects/float_bounded_sequence.hpp" -#include "type_objects/float_bounded_sequencePubSubTypes.h" +#include "type_objects/float_bounded_sequencePubSubTypes.hpp" #include "type_objects/hello_world.hpp" -#include "type_objects/hello_worldPubSubTypes.h" +#include "type_objects/hello_worldPubSubTypes.hpp" #include "type_objects/map_struct.hpp" -#include "type_objects/map_structPubSubTypes.h" +#include "type_objects/map_structPubSubTypes.hpp" #include "type_objects/numeric_array.hpp" -#include "type_objects/numeric_arrayPubSubTypes.h" +#include "type_objects/numeric_arrayPubSubTypes.hpp" #include "type_objects/union_struct.hpp" -#include "type_objects/union_structPubSubTypes.h" +#include "type_objects/union_structPubSubTypes.hpp" namespace test { diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp index eff9b5ef..e94655a4 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_HPP_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_HPP_ +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp index a8be1936..d777ee1c 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP #include "arrays_and_sequences.hpp" @@ -49,5 +49,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp index d5d27a39..8a5c223f 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP #include "arrays_and_sequencesCdrAux.hpp" @@ -214,5 +214,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCESCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx index 817ea559..cd805263 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "arrays_and_sequencesPubSubTypes.h" +#include "arrays_and_sequencesPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp similarity index 91% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp index 4ff0381f..4b3677a4 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file arrays_and_sequencesPubSubTypes.h + * @file arrays_and_sequencesPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "arrays_and_sequences.hpp" @@ -106,7 +106,7 @@ class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,7 +124,7 @@ class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -197,7 +197,7 @@ class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataT } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -215,10 +215,10 @@ class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataT #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp index 6f6fb054..43f145f3 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP #include @@ -65,4 +65,4 @@ eProsima_user_DllExport void register_arrays_and_sequences_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp index bd064fe7..1352a2e4 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_HPP_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_HPP_ +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp index aa07447f..3bbf1a9a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP #include "basic_array_struct.hpp" @@ -49,5 +49,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp index 4d1ab4f1..ebd5483e 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP #include "basic_array_structCdrAux.hpp" @@ -206,5 +206,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCTCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx index 52210117..88043626 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "basic_array_structPubSubTypes.h" +#include "basic_array_structPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp similarity index 91% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp index 35dd7f7a..057e6dda 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file basic_array_structPubSubTypes.h + * @file basic_array_structPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "basic_array_struct.hpp" @@ -106,7 +106,7 @@ class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicData } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,7 +124,7 @@ class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicData #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -197,7 +197,7 @@ class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataTyp } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -215,10 +215,10 @@ class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataTyp #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp index c6be16a7..afa3f5f9 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP #include @@ -65,4 +65,4 @@ eProsima_user_DllExport void register_basic_array_struct_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp index 03642cf3..9ba4805a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_HPP_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_HPP_ +#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCT_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp index 1b9a2ea8..ac32e369 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP #include "basic_struct.hpp" @@ -49,5 +49,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp index d936fdf2..baa8d4ad 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP +#define FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP #include "basic_structCdrAux.hpp" @@ -190,5 +190,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_BASIC_STRUCTCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx index e666461d..e42464da 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "basic_structPubSubTypes.h" +#include "basic_structPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp similarity index 91% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp index 941c4e7a..29824879 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file basic_structPubSubTypes.h + * @file basic_structPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "basic_struct.hpp" @@ -106,7 +106,7 @@ class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,7 +124,7 @@ class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -197,7 +197,7 @@ class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -215,10 +215,10 @@ class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp index 63cc1a64..d2cc9a74 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP #include @@ -65,4 +65,4 @@ eProsima_user_DllExport void register_basic_struct_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp index f1cb9210..98e9d533 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_HPP_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_HPP_ +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCE_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp index 11d7c4bd..a1d9b9ad 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_HPP_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP #include "char_sequence.hpp" @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp index 756dc0bd..ef63929e 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_IPP_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP #include "char_sequenceCdrAux.hpp" @@ -114,5 +114,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCECDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx index 5f6f1d61..c066f9e0 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "char_sequencePubSubTypes.h" +#include "char_sequencePubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp similarity index 89% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp index acd3e497..90af7267 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file char_sequencePubSubTypes.h + * @file char_sequencePubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "char_sequence.hpp" @@ -106,7 +106,7 @@ class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp index 7167bf5a..45d4779e 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP #include @@ -53,4 +53,4 @@ eProsima_user_DllExport void register_char_sequence_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp index 044a0055..1f7a722b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_HPP_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_HPP_ +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp index ee7758a8..d5085176 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP #include "complex_nested_arrays.hpp" @@ -63,5 +63,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp index 43e2c0e8..6744f03e 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP #include "complex_nested_arraysCdrAux.hpp" @@ -374,5 +374,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYSCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx index 03309374..25169cfa 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "complex_nested_arraysPubSubTypes.h" +#include "complex_nested_arraysPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp similarity index 93% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp index 74a5eea3..578f1555 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file complex_nested_arraysPubSubTypes.h + * @file complex_nested_arraysPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "complex_nested_arrays.hpp" @@ -106,7 +106,7 @@ class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,7 +124,7 @@ class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -197,7 +197,7 @@ class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataTyp } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -215,7 +215,7 @@ class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataTyp #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -288,7 +288,7 @@ class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -306,7 +306,7 @@ class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; @@ -379,7 +379,7 @@ class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicData } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -397,10 +397,10 @@ class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicData #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp index b575368d..aec5bb21 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP #include @@ -89,4 +89,4 @@ eProsima_user_DllExport void register_complex_nested_arrays_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp index db561935..3e39c043 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_HPP_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_HPP_ +#ifndef FAST_DDS_GENERATED__ENUM_STRUCT_HPP +#define FAST_DDS_GENERATED__ENUM_STRUCT_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp index 9e1aa367..285c5fc7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_HPP +#define FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_HPP #include "enum_struct.hpp" @@ -43,5 +43,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp index 28ac17b0..8a43f231 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_IPP +#define FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_IPP #include "enum_structCdrAux.hpp" @@ -122,5 +122,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_ENUM_STRUCTCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx index 497c3a96..a742fab7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "enum_structPubSubTypes.h" +#include "enum_structPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.hpp similarity index 89% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.hpp index fee1678d..b69dda7e 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file enum_structPubSubTypes.h + * @file enum_structPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__ENUM_STRUCT_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__ENUM_STRUCT_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "enum_struct.hpp" @@ -106,7 +106,7 @@ class enum_structPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class enum_structPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__ENUM_STRUCT_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp index 288179a2..70026eb9 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP #include @@ -65,4 +65,4 @@ eProsima_user_DllExport void register_enum_struct_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp index 983bb95d..641f52d9 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_HPP_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_HPP_ +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp index 432e9029..d41f390b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_HPP_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP #include "float_bounded_sequence.hpp" @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp index 9903c557..a167cf15 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_IPP_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP #include "float_bounded_sequenceCdrAux.hpp" @@ -114,5 +114,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCECDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx index 230b2cb0..8c70ebed 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "float_bounded_sequencePubSubTypes.h" +#include "float_bounded_sequencePubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp similarity index 88% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp index 1b2cbb5b..ffc3557f 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file float_bounded_sequencePubSubTypes.h + * @file float_bounded_sequencePubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "float_bounded_sequence.hpp" @@ -106,7 +106,7 @@ class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDat } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDat #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp index bdf59876..78dab6b6 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP #include @@ -53,4 +53,4 @@ eProsima_user_DllExport void register_float_bounded_sequence_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp index 282793dd..27ca777d 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_HPP_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_HPP_ +#ifndef FAST_DDS_GENERATED__HELLO_WORLD_HPP +#define FAST_DDS_GENERATED__HELLO_WORLD_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp index 80a73b13..4837eee8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP +#define FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP #include "hello_world.hpp" @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp index 1f22846b..fd4e9f07 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP +#define FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP #include "hello_worldCdrAux.hpp" @@ -122,5 +122,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_HELLO_WORLDCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx index 20d36fe0..f57610d0 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "hello_worldPubSubTypes.h" +#include "hello_worldPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp similarity index 89% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp index faf7f1f1..47a4baa3 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file hello_worldPubSubTypes.h + * @file hello_worldPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "hello_world.hpp" @@ -106,7 +106,7 @@ class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp index dcf5d1a6..d0a80dd8 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP #include @@ -53,4 +53,4 @@ eProsima_user_DllExport void register_hello_world_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp index bbc4bdc8..cb2ed629 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_HPP_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_HPP_ +#ifndef FAST_DDS_GENERATED__MAP_STRUCT_HPP +#define FAST_DDS_GENERATED__MAP_STRUCT_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp index be6fde96..bb78ac3b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_HPP +#define FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_HPP #include "map_struct.hpp" @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp index e49ea33b..2fc10980 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_IPP +#define FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_IPP #include "map_structCdrAux.hpp" @@ -114,5 +114,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_MAP_STRUCTCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx index f1f4135e..4b3396a9 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "map_structPubSubTypes.h" +#include "map_structPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.hpp similarity index 89% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.hpp index df4db174..d9edf340 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file map_structPubSubTypes.h + * @file map_structPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__MAP_STRUCT_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__MAP_STRUCT_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "map_struct.hpp" @@ -106,7 +106,7 @@ class map_structPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class map_structPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__MAP_STRUCT_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp index c0af3f4f..6a1a1e1d 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP #include @@ -53,4 +53,4 @@ eProsima_user_DllExport void register_map_struct_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp index 7ae80c45..a78917ad 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_HPP_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_HPP_ +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAY_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp index a058c1a8..a00c7007 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP #include "numeric_array.hpp" @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp index 41c1c7ad..a6c384ed 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP #include "numeric_arrayCdrAux.hpp" @@ -114,5 +114,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAYCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx index 2f0bef6c..66b7701c 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "numeric_arrayPubSubTypes.h" +#include "numeric_arrayPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp similarity index 89% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp index 7926ec43..d65cea0b 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file numeric_arrayPubSubTypes.h + * @file numeric_arrayPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "numeric_array.hpp" @@ -106,7 +106,7 @@ class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp index 05a27bf5..b6219fd7 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP #include @@ -53,4 +53,4 @@ eProsima_user_DllExport void register_numeric_array_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp index 20aad0b7..4ec3a99c 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_HPP_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_HPP_ +#ifndef FAST_DDS_GENERATED__UNION_STRUCT_HPP +#define FAST_DDS_GENERATED__UNION_STRUCT_HPP #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp index 19fe3c1b..6a6d3b85 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_HPP +#define FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_HPP #include "union_struct.hpp" @@ -43,5 +43,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp index 3472d9e6..372fcc5a 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_IPP +#define FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_IPP #include "union_structCdrAux.hpp" @@ -273,5 +273,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_UNION_STRUCTCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_IPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx index 42ae3286..7a2ddc63 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx @@ -19,7 +19,7 @@ * This file was generated by the tool fastddsgen. */ -#include "union_structPubSubTypes.h" +#include "union_structPubSubTypes.hpp" #include #include diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.hpp similarity index 89% rename from ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h rename to ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.hpp index a2e412b4..29fdef4c 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.h +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.hpp @@ -13,21 +13,21 @@ // limitations under the License. /*! - * @file union_structPubSubTypes.h + * @file union_structPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__UNION_STRUCT_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__UNION_STRUCT_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include #include "union_struct.hpp" @@ -106,7 +106,7 @@ class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -124,10 +124,10 @@ class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; + eprosima::fastdds::MD5 m_md5; unsigned char* m_keyBuffer; }; -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__UNION_STRUCT_PUBSUBTYPES_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp index 6e1e1dbf..6949f933 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ -#define _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#ifndef FAST_DDS_GENERATED__UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP #include @@ -65,4 +65,4 @@ eProsima_user_DllExport void register_union_struct_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP_ +#endif // FAST_DDS_GENERATED__UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp b/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp index 1251d8ea..21550513 100644 --- a/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp +++ b/ddspipe_core/test/unittest/types/endpoint/GuidTest.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp b/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp index d23c502e..860f4e1b 100644 --- a/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp +++ b/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp @@ -14,8 +14,7 @@ #pragma once -#include -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 109ae2cf..ead6fbea 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -25,9 +25,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index 8b8fb3a9..1c12d19f 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -16,12 +16,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp index 4289ebac..c33fe45d 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp @@ -14,7 +14,7 @@ #pragma once -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp index dc6e0e76..e5303964 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp @@ -14,7 +14,7 @@ #pragma once -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index 8304e884..addfcc42 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -19,13 +19,13 @@ #include #include -#include -#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp b/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp index 00fd09a8..3770fb80 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp @@ -16,7 +16,7 @@ #include -#include +#include #include diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp index 3d8f78e7..54c049b7 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/RouterCacheChange.hpp @@ -14,7 +14,7 @@ #pragma once -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp index 97d71c4c..78a0ce30 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/types/security/tls/TlsConfiguration.hpp b/ddspipe_participants/include/ddspipe_participants/types/security/tls/TlsConfiguration.hpp index bb07c1c1..db4736c9 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/security/tls/TlsConfiguration.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/security/tls/TlsConfiguration.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include diff --git a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp index 177cee1e..9f1dce11 100644 --- a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp +++ b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp @@ -14,9 +14,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp index 06f7eec7..dc819ad2 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp @@ -14,12 +14,12 @@ #pragma once -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index 45418481..2b249711 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -21,15 +21,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp index ed9d2de5..3a466618 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/QoSSpecificWriter.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp index aa0f413b..11699727 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp @@ -14,12 +14,12 @@ #pragma once -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 8e790cdb..84b1d16b 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -22,10 +22,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include @@ -95,15 +95,18 @@ void DynTypesParticipant::onReaderDiscovery( fastdds::rtps::ReaderDiscoveryInfo&& info, bool& should_be_ignored) { - fastdds::rtps::ReaderProxyData proxy_copy(info.info); + if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) + { + fastdds::rtps::ReaderProxyData proxy_copy(info.info); - // Get type information - const auto type_info = proxy_copy.type_information().type_information; - const auto type_name = proxy_copy.typeName(); + // Get type information + const auto type_info = proxy_copy.type_information().type_information; + const auto type_name = proxy_copy.typeName(); - rtps::CommonParticipant::onReaderDiscovery(participant, std::move(info), should_be_ignored); + rtps::CommonParticipant::onReaderDiscovery(participant, std::move(info), should_be_ignored); - notify_type_discovered_(type_info, type_name); + notify_type_discovered_(type_info, type_name); + } } void DynTypesParticipant::onWriterDiscovery( @@ -111,15 +114,18 @@ void DynTypesParticipant::onWriterDiscovery( fastdds::rtps::WriterDiscoveryInfo&& info, bool& should_be_ignored) { - fastdds::rtps::WriterProxyData proxy_copy(info.info); + if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) + { + fastdds::rtps::WriterProxyData proxy_copy(info.info); - // Get type information - const auto type_info = proxy_copy.type_information().type_information; - const auto type_name = proxy_copy.typeName(); + // Get type information + const auto type_info = proxy_copy.type_information().type_information; + const auto type_name = proxy_copy.typeName(); - rtps::CommonParticipant::onWriterDiscovery(participant, std::move(info), should_be_ignored); + rtps::CommonParticipant::onWriterDiscovery(participant, std::move(info), should_be_ignored); - notify_type_discovered_(type_info, type_name); + notify_type_discovered_(type_info, type_name); + } } void DynTypesParticipant::notify_type_discovered_( diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index dcda5204..85789006 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -15,12 +15,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index cf5c1625..df64e7b3 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index 2b19f7ed..72af219e 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp index bfcdb88d..30d21e64 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp @@ -14,11 +14,11 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include diff --git a/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp index 942297aa..f10605f9 100644 --- a/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/SimpleReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp index 0257aba9..361b3b4d 100644 --- a/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp index 821cb9f3..5c993539 100644 --- a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 026eca6d..800403ab 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include diff --git a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp index b8573dc4..7ca1cbb4 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp index a79b035b..357da952 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/types/address/Address.cpp b/ddspipe_participants/src/cpp/types/address/Address.cpp index 245e4aa8..f4d6ded4 100644 --- a/ddspipe_participants/src/cpp/types/address/Address.cpp +++ b/ddspipe_participants/src/cpp/types/address/Address.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index 76b4fe69..af27b1e7 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp index cfd0f910..9dc117d9 100644 --- a/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp index 014aca6d..e3c844b2 100644 --- a/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/SimpleWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index 3a8bb239..208f1ab7 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index b22fe481..a1a29200 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp index 296570e5..6ed23659 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp index 14bbc374..0e01a6fc 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp @@ -13,9 +13,9 @@ // limitations under the License. -#include -#include -#include +#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp b/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp index e7e3d85d..444630a8 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/filter/RepeaterDataFilter.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include diff --git a/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp b/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp index 2939942f..f3a874de 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/filter/SelfDataFilter.cpp @@ -13,8 +13,8 @@ // limitations under the License. -#include -#include +#include +#include #include #include From 1a02e76b226da0e161a6516858b1f62e25d3e7bc Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Thu, 11 Jul 2024 15:22:01 +0200 Subject: [PATCH 13/53] Update repository with new changes in Fast DDS 3.x Signed-off-by: Lucia Echevarria --- .../ddspipe_core/types/dds/GuidPrefix.hpp | 1 - .../writer/rtps/CommonWriter.hpp | 8 ++-- .../writer/rtps/filter/SelfDataFilter.hpp | 4 +- .../rtps/DiscoveryServerParticipant.cpp | 8 ++-- .../src/cpp/writer/rtps/CommonWriter.cpp | 45 +++++++++---------- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp index f8e93dd1..c71c484a 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp @@ -14,7 +14,6 @@ #pragma once -#include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index 2b249711..4aba6baf 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -62,7 +62,7 @@ namespace rtps { /** * Abstract generic class for a RTPS Writer wrapper. * - * It implements the WriterListener for itself with \c onWriterMatched callbacks. + * It implements the WriterListener for itself with \c on_writer_matched callbacks. * * @warning This object is not RAII and must be initialized before used. */ @@ -112,9 +112,9 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener * @param [in] info information about the matched Reader */ DDSPIPE_PARTICIPANTS_DllAPI - void onWriterMatched( + void on_writer_matched( fastdds::rtps::RTPSWriter*, - fastdds::rtps::MatchingInfo& info) noexcept override; + const fastdds::rtps::MatchingInfo& info) noexcept override; /** * @brief CommonWriter Listener callback when all the Readers have received a change. @@ -125,7 +125,7 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener * @param [in] ch the change that has been acknowledged by all the Readers. */ DDSPIPE_PARTICIPANTS_DllAPI - void onWriterChangeReceivedByAll( + void on_writer_change_received_by_all( fastdds::rtps::RTPSWriter*, fastdds::rtps::CacheChange_t* change) override; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp index eddcfacd..8b561cb2 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/filter/SelfDataFilter.hpp @@ -21,14 +21,14 @@ ///// // Forward declarations namespace eprosima { -namespace fastrtps { +namespace fastdds { namespace rtps { struct CacheChange_t; struct GUID_t; } /* namespace rtps */ -} /* namespace fastrtps */ +} /* namespace fastdds */ } /* namespace eprosima */ namespace eprosima { diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index df64e7b3..8940bae1 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -229,8 +229,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_( has_connection_addresses = true; - eprosima::fastdds::rtps::RemoteServerAttributes server_attr; - server_attr.guidPrefix = server_prefix; + // eprosima::fastdds::rtps::RemoteServerAttributes server_attr; + // server_attr.guidPrefix = server_prefix; eprosima::fastdds::rtps::Locator_t locator; @@ -265,8 +265,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_( // Warning: Logical port is not needed unless domain could change // Add as remote server and add it to builtin - server_attr.metatrafficUnicastLocatorList.push_back(locator); - params.builtin.discovery_config.m_DiscoveryServers.push_back(server_attr); + // server_attr.metatrafficUnicastLocatorList.push_back(locator); + params.builtin.discovery_config.m_DiscoveryServers.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Add connection address " << address << " for server " << server_prefix << diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index a1a29200..cbc68599 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -105,9 +105,9 @@ void CommonWriter::init() pool_configuration_); } -void CommonWriter::onWriterMatched( +void CommonWriter::on_writer_matched( fastdds::rtps::RTPSWriter*, - fastdds::rtps::MatchingInfo& info) noexcept + const fastdds::rtps::MatchingInfo& info) noexcept { if (!come_from_this_participant_(info.remoteEndpointGuid)) { @@ -126,7 +126,7 @@ void CommonWriter::onWriterMatched( } } -void CommonWriter::onWriterChangeReceivedByAll( +void CommonWriter::on_writer_change_received_by_all( fastdds::rtps::RTPSWriter* /*writer*/, fastdds::rtps::CacheChange_t* change) { @@ -170,13 +170,13 @@ utils::ReturnCode CommonWriter::write_nts_( if (topic_.topic_qos.keyed) { - new_change = rtps_writer_->new_change( + new_change = rtps_history_->create_change( rtps_data.kind, rtps_data.instanceHandle); } else { - new_change = rtps_writer_->new_change(rtps_data.kind); + new_change = rtps_history_->create_change(rtps_data.kind); } // If still is not able to get a change, return an error code @@ -203,7 +203,7 @@ utils::ReturnCode CommonWriter::write_nts_( // Send data by adding it to CommonWriter History rtps_history_->add_change(new_change, write_params); - // In the case of BEST_EFFORT, add_change calls onWriterChangeReceivedByAll (which removes the change). + // In the case of BEST_EFFORT, add_change calls on_writer_change_received_by_all (which removes the change). // At this point, write params is now the output of adding change fill_sent_data_(write_params, rtps_data); @@ -268,34 +268,33 @@ void CommonWriter::internal_entities_creation_( // Copy writer attributes because fast needs it non const (do not ask why) fastdds::rtps::WriterAttributes non_const_writer_attributes = writer_attributes; - // Create History - rtps_history_ = new fastdds::rtps::WriterHistory(history_attributes); - // Create CommonWriter // Listener must be set in creation as no callbacks should be missed // It is safe to do so here as object is already created and callbacks do not require anything set in this method if (repeater_) { - logDebug(DDSPIPE_RTPS_COMMONWRITER, "CommonWriter created with repeater filter"); - - rtps_writer_ = fastdds::rtps::RTPSDomain::createRTPSWriter( - rtps_participant_, - non_const_writer_attributes, + // Create History + rtps_history_ = new fastdds::rtps::WriterHistory( + history_attributes, payload_pool_, - std::make_shared(pool_configuration), - rtps_history_, - this); + std::make_shared(pool_configuration)); + + logDebug(DDSPIPE_RTPS_COMMONWRITER, "CommonWriter created with repeater filter"); } else { - rtps_writer_ = fastdds::rtps::RTPSDomain::createRTPSWriter( - rtps_participant_, - non_const_writer_attributes, - payload_pool_, - rtps_history_, - this); + // Create History + rtps_history_ = new fastdds::rtps::WriterHistory( + history_attributes, + payload_pool_); } + rtps_writer_ = fastdds::rtps::RTPSDomain::createRTPSWriter( + rtps_participant_, + non_const_writer_attributes, + rtps_history_, + this); + if (!rtps_writer_) { throw utils::InitializationException( From 87734a07402f9dfb112d75a70527bc3d03a3a1d1 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 16 Jul 2024 10:46:41 +0200 Subject: [PATCH 14/53] Remove DynamicType to IDL serialization from DDSPipe Signed-off-by: Lucia Echevarria --- .../types/dynamic_types/schema.hpp | 10 - .../cpp/types/dynamic_types/schema_idl.cpp | 504 ----------- .../test/unittest/types/CMakeLists.txt | 1 - .../types/dynamic_types/CMakeLists.txt | 101 --- .../types/dynamic_types/dtypes_idl_tests.cpp | 110 --- .../types/dynamic_types/dtypes_msg_tests.cpp | 102 --- .../types/dynamic_types/types/all_types.hpp | 144 ---- .../types/idls/arrays_and_sequences.idl | 12 - .../types/idls/basic_array_struct.idl | 11 - .../dynamic_types/types/idls/basic_struct.idl | 9 - .../types/idls/char_sequence.idl | 4 - .../types/idls/complex_nested_arrays.idl | 23 - .../dynamic_types/types/idls/enum_struct.idl | 12 - .../types/idls/float_bounded_sequence.idl | 4 - .../dynamic_types/types/idls/hello_world.idl | 5 - .../dynamic_types/types/idls/map_struct.idl | 4 - .../types/idls/numeric_array.idl | 4 - .../dynamic_types/types/idls/union_struct.idl | 15 - .../types/msgs/arrays_and_sequences.msg | 7 - .../types/msgs/basic_array_struct.msg | 6 - .../dynamic_types/types/msgs/basic_struct.msg | 4 - .../types/msgs/char_sequence.msg | 1 - .../types/msgs/complex_nested_arrays.msg | 14 - .../types/msgs/float_bounded_sequence.msg | 1 - .../dynamic_types/types/msgs/hello_world.msg | 2 - .../types/msgs/numeric_array.msg | 1 - .../type_objects/arrays_and_sequences.hpp | 445 ---------- .../arrays_and_sequencesCdrAux.hpp | 53 -- .../arrays_and_sequencesCdrAux.ipp | 218 ----- .../arrays_and_sequencesPubSubTypes.cxx | 422 --------- .../arrays_and_sequencesPubSubTypes.hpp | 224 ----- .../arrays_and_sequencesTypeObjectSupport.cxx | 341 -------- .../arrays_and_sequencesTypeObjectSupport.hpp | 68 -- .../types/type_objects/basic_array_struct.hpp | 386 --------- .../type_objects/basic_array_structCdrAux.hpp | 53 -- .../type_objects/basic_array_structCdrAux.ipp | 210 ----- .../basic_array_structPubSubTypes.cxx | 422 --------- .../basic_array_structPubSubTypes.hpp | 224 ----- .../basic_array_structTypeObjectSupport.cxx | 251 ------ .../basic_array_structTypeObjectSupport.hpp | 68 -- .../types/type_objects/basic_struct.hpp | 311 ------- .../types/type_objects/basic_structCdrAux.hpp | 53 -- .../types/type_objects/basic_structCdrAux.ipp | 194 ----- .../type_objects/basic_structPubSubTypes.cxx | 422 --------- .../type_objects/basic_structPubSubTypes.hpp | 224 ----- .../basic_structTypeObjectSupport.cxx | 157 ---- .../basic_structTypeObjectSupport.hpp | 68 -- .../types/type_objects/char_sequence.hpp | 190 ---- .../type_objects/char_sequenceCdrAux.hpp | 46 - .../type_objects/char_sequenceCdrAux.ipp | 118 --- .../type_objects/char_sequencePubSubTypes.cxx | 229 ----- .../type_objects/char_sequencePubSubTypes.hpp | 133 --- .../char_sequenceTypeObjectSupport.cxx | 132 --- .../char_sequenceTypeObjectSupport.hpp | 56 -- .../type_objects/complex_nested_arrays.hpp | 760 ---------------- .../complex_nested_arraysCdrAux.hpp | 67 -- .../complex_nested_arraysCdrAux.ipp | 378 -------- .../complex_nested_arraysPubSubTypes.cxx | 808 ------------------ .../complex_nested_arraysPubSubTypes.hpp | 406 --------- ...complex_nested_arraysTypeObjectSupport.cxx | 493 ----------- ...complex_nested_arraysTypeObjectSupport.hpp | 92 -- .../types/type_objects/enum_struct.hpp | 225 ----- .../types/type_objects/enum_structCdrAux.hpp | 47 - .../types/type_objects/enum_structCdrAux.ipp | 126 --- .../type_objects/enum_structPubSubTypes.cxx | 229 ----- .../type_objects/enum_structPubSubTypes.hpp | 133 --- .../enum_structTypeObjectSupport.cxx | 185 ---- .../enum_structTypeObjectSupport.hpp | 68 -- .../type_objects/float_bounded_sequence.hpp | 190 ---- .../float_bounded_sequenceCdrAux.hpp | 46 - .../float_bounded_sequenceCdrAux.ipp | 118 --- .../float_bounded_sequencePubSubTypes.cxx | 229 ----- .../float_bounded_sequencePubSubTypes.hpp | 133 --- ...loat_bounded_sequenceTypeObjectSupport.cxx | 132 --- ...loat_bounded_sequenceTypeObjectSupport.hpp | 56 -- .../types/type_objects/hello_world.hpp | 227 ----- .../types/type_objects/hello_worldCdrAux.hpp | 46 - .../types/type_objects/hello_worldCdrAux.ipp | 126 --- .../type_objects/hello_worldPubSubTypes.cxx | 229 ----- .../type_objects/hello_worldPubSubTypes.hpp | 133 --- .../hello_worldTypeObjectSupport.cxx | 138 --- .../hello_worldTypeObjectSupport.hpp | 56 -- .../types/type_objects/map_struct.hpp | 191 ----- .../types/type_objects/map_structCdrAux.hpp | 46 - .../types/type_objects/map_structCdrAux.ipp | 118 --- .../type_objects/map_structPubSubTypes.cxx | 229 ----- .../type_objects/map_structPubSubTypes.hpp | 133 --- .../map_structTypeObjectSupport.cxx | 167 ---- .../map_structTypeObjectSupport.hpp | 56 -- .../types/type_objects/numeric_array.hpp | 189 ---- .../type_objects/numeric_arrayCdrAux.hpp | 46 - .../type_objects/numeric_arrayCdrAux.ipp | 118 --- .../type_objects/numeric_arrayPubSubTypes.cxx | 229 ----- .../type_objects/numeric_arrayPubSubTypes.hpp | 133 --- .../numeric_arrayTypeObjectSupport.cxx | 134 --- .../numeric_arrayTypeObjectSupport.hpp | 56 -- .../types/type_objects/union_struct.hpp | 676 --------------- .../types/type_objects/union_structCdrAux.hpp | 47 - .../types/type_objects/union_structCdrAux.ipp | 277 ------ .../type_objects/union_structPubSubTypes.cxx | 229 ----- .../type_objects/union_structPubSubTypes.hpp | 133 --- .../union_structTypeObjectSupport.cxx | 291 ------- .../union_structTypeObjectSupport.hpp | 68 -- 103 files changed, 16271 deletions(-) delete mode 100644 ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/enum_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/map_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/union_struct.idl delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.hpp delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx delete mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp index 31beb747..69a261ab 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/schema.hpp @@ -26,15 +26,6 @@ namespace eprosima { namespace ddspipe { namespace core { namespace types { - -namespace idl { - -DDSPIPE_CORE_DllAPI -std::string generate_idl_schema( - const fastdds::dds::DynamicType::_ref_type& dynamic_type); - -} /* namespace idl */ - namespace msg { DDSPIPE_CORE_DllAPI @@ -42,7 +33,6 @@ std::string generate_ros2_schema( const fastdds::dds::DynamicType::_ref_type& dynamic_type); } /* namespace msg */ - } /* namespace types */ } /* namespace core */ } /* namespace ddspipe */ diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp deleted file mode 100644 index dd3f214d..00000000 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_idl.cpp +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright 2023 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 schema_idl.cpp - */ - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -namespace eprosima { -namespace ddspipe { -namespace core { -namespace types { -namespace idl { - -// TODO: Include compability with TK_ALIAS, TK_BITSET AND TK_BITMASK - -constexpr const char* TYPE_OPENING = - "\n{\n"; - -constexpr const char* TYPE_CLOSURE = - "};\n"; - -constexpr const char* TAB_SEPARATOR = - " "; - -struct TreeNodeType -{ - TreeNodeType( - std::string member_name, - std::string type_kind_name, - fastdds::dds::DynamicType::_ref_type dynamic_type) - : member_name(member_name) - , type_kind_name(type_kind_name) - , dynamic_type(dynamic_type) - { - } - - std::string member_name; - std::string type_kind_name; - fastdds::dds::DynamicType::_ref_type dynamic_type; -}; - -// Forward declaration -std::string type_kind_to_str( - const fastdds::dds::DynamicType::_ref_type& type); - -fastdds::dds::DynamicType::_ref_type container_internal_type( - const fastdds::dds::DynamicType::_ref_type& dyn_type) -{ - fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; - - const auto ret = dyn_type->get_descriptor(type_descriptor); - if (ret != fastdds::dds::RETCODE_OK) - { - throw utils::InconsistencyException("No Type Descriptor, failed to get conatiner internal type"); - } - - return type_descriptor->element_type(); -} - -fastdds::dds::BoundSeq container_size( - const fastdds::dds::DynamicType::_ref_type& dyn_type) -{ - fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; - - const auto ret = dyn_type->get_descriptor(type_descriptor); - if (ret != fastdds::dds::RETCODE_OK) - { - throw utils::InconsistencyException("No Type Descriptor, failed to get container size"); - } - - return type_descriptor->bound(); -} - -std::vector> get_members_sorted( - const fastdds::dds::DynamicType::_ref_type& dyn_type) -{ - std::vector> result; - - std::map members; - dyn_type->get_all_members(members); - - for (const auto& member : members) - { - fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; - - const auto ret = member.second->get_descriptor(member_descriptor); - if (ret != fastdds::dds::RETCODE_OK) - { - throw utils::InconsistencyException("No Member Descriptor, failed to get sorted members"); - } - - result.emplace_back( - std::make_pair( - member.second->get_name().to_string(), - std::move(member_descriptor->type()))); - } - - return result; -} - -std::string array_kind_to_str( - const fastdds::dds::DynamicType::_ref_type& dyn_type) -{ - auto internal_type = container_internal_type(dyn_type); - auto this_array_size = container_size(dyn_type); - - std::stringstream ss; - ss << type_kind_to_str(internal_type); - - for (const auto& bound : this_array_size) - { - ss << "[" << bound << "]"; - } - - return ss.str(); -} - -std::string sequence_kind_to_str( - const fastdds::dds::DynamicType::_ref_type& dyn_type) -{ - auto internal_type = container_internal_type(dyn_type); - auto this_sequence_size = container_size(dyn_type); - - std::stringstream ss; - ss << "sequence<" << type_kind_to_str(internal_type); - - for (const auto& bound : this_sequence_size) - { - if (bound != fastdds::dds::xtypes::INVALID_LBOUND) - { - ss << ", " << bound; - } - } - ss << ">"; - - return ss.str(); -} - -std::string map_kind_to_str( - const fastdds::dds::DynamicType::_ref_type& dyn_type) -{ - std::stringstream ss; - fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; - - const auto ret = dyn_type->get_descriptor(type_descriptor); - if (ret != fastdds::dds::RETCODE_OK) - { - throw utils::InconsistencyException("No Type Descriptor, failed to map kind"); - } - - const auto key_type = type_descriptor->key_element_type(); - const auto value_type = type_descriptor->element_type(); - - ss << "map<" << type_kind_to_str(key_type) << ", " << type_kind_to_str(value_type) << ">"; - - return ss.str(); -} - -std::string type_kind_to_str( - const fastdds::dds::DynamicType::_ref_type& dyn_type) -{ - switch (dyn_type->get_kind()) - { - case fastdds::dds::xtypes::TK_BOOLEAN: - return "boolean"; - - case fastdds::dds::xtypes::TK_BYTE: - return "octet"; - - case fastdds::dds::xtypes::TK_INT8: - return "short"; - - case fastdds::dds::xtypes::TK_INT16: - return "short"; - - case fastdds::dds::xtypes::TK_INT32: - return "long"; - - case fastdds::dds::xtypes::TK_INT64: - return "long long"; - - case fastdds::dds::xtypes::TK_UINT8: - return "unsigned short"; - - case fastdds::dds::xtypes::TK_UINT16: - return "unsigned short"; - - case fastdds::dds::xtypes::TK_UINT32: - return "unsigned long"; - - case fastdds::dds::xtypes::TK_UINT64: - return "unsigned long long"; - - case fastdds::dds::xtypes::TK_FLOAT32: - return "float"; - - case fastdds::dds::xtypes::TK_FLOAT64: - return "double"; - - case fastdds::dds::xtypes::TK_FLOAT128: - return "long double"; - - case fastdds::dds::xtypes::TK_CHAR8: - return "char"; - - case fastdds::dds::xtypes::TK_CHAR16: - return "wchar"; - - case fastdds::dds::xtypes::TK_STRING8: - return "string"; - - case fastdds::dds::xtypes::TK_STRING16: - return "wstring"; - - case fastdds::dds::xtypes::TK_ARRAY: - return array_kind_to_str(dyn_type); - - case fastdds::dds::xtypes::TK_SEQUENCE: - return sequence_kind_to_str(dyn_type); - - case fastdds::dds::xtypes::TK_MAP: - return map_kind_to_str(dyn_type); - - case fastdds::dds::xtypes::TK_STRUCTURE: - case fastdds::dds::xtypes::TK_ENUM: - case fastdds::dds::xtypes::TK_UNION: - return dyn_type->get_name().to_string(); - - case fastdds::dds::xtypes::TK_BITSET: - case fastdds::dds::xtypes::TK_BITMASK: - case fastdds::dds::xtypes::TK_NONE: - throw utils::UnsupportedException( - STR_ENTRY << "Type " << dyn_type->get_name() << " is not supported."); - - default: - throw utils::InconsistencyException( - STR_ENTRY << "Type " << dyn_type->get_name() << " has not correct kind."); - - } -} - -utils::TreeNode generate_dyn_type_tree( - const fastdds::dds::DynamicType::_ref_type& type, - const std::string& member_name = "PARENT") -{ - // Get kind - fastdds::dds::xtypes::TypeKind kind = type->get_kind(); - - switch (kind) - { - case fastdds::dds::xtypes::TK_STRUCTURE: - { - // If is struct, the call is recursive. - // Create new tree node - utils::TreeNode parent(member_name, (type->get_name()).to_string(), type); - - // Get all members of this struct - const std::vector> members_by_name = get_members_sorted(type); - - for (const auto& member : members_by_name) - { - // Add each member with its name as a new node in a branch (recursion) - parent.add_branch( - generate_dyn_type_tree(member.second, member.first)); - } - return parent; - } - - case fastdds::dds::xtypes::TK_ARRAY: - case fastdds::dds::xtypes::TK_SEQUENCE: - { - // If container (array or struct) has exactly one branch - // Calculate child branch - auto internal_type = container_internal_type(type); - - // Create this node - utils::TreeNode container(member_name, type_kind_to_str(type), type); - // Add branch - container.add_branch(generate_dyn_type_tree(internal_type, "CONTAINER_MEMBER")); - - return container; - } - - default: - return utils::TreeNode(member_name, type_kind_to_str(type), type); - } -} - -std::ostream& node_to_str( - std::ostream& os, - const utils::TreeNode& node) -{ - os << TAB_SEPARATOR; - - if (node.info.dynamic_type->get_kind() == fastdds::dds::xtypes::TK_ARRAY) - { - auto dim_pos = node.info.type_kind_name.find("["); - auto kind_name_str = node.info.type_kind_name.substr(0, dim_pos); - auto dim_str = node.info.type_kind_name.substr(dim_pos, std::string::npos); - - os << kind_name_str << " " << node.info.member_name << dim_str; - } - else - { - os << node.info.type_kind_name << " " << node.info.member_name; - } - - return os; -} - -std::ostream& struct_to_str( - std::ostream& os, - const utils::TreeNode& node) -{ - // Add types name - os << "struct " << node.info.type_kind_name << TYPE_OPENING; - - // Add struct attributes - for (auto const& child : node.branches()) - { - node_to_str(os, child.info); - os << ";\n"; - } - - // Close definition - os << TYPE_CLOSURE; - - return os; -} - -std::ostream& enum_to_str( - std::ostream& os, - const utils::TreeNode& node) -{ - os << "enum " << node.info.type_kind_name << TYPE_OPENING << TAB_SEPARATOR; - - std::map members; - - node.info.dynamic_type->get_all_members(members); - - bool first_iter = true; - for (const auto& member : members) - { - if (!first_iter) - { - os << ",\n" << TAB_SEPARATOR; - } - first_iter = false; - - os << member.second->get_name(); - } - - // Close definition - os << "\n" << TYPE_CLOSURE; - - return os; -} - -std::ostream& union_to_str( - std::ostream& os, - const utils::TreeNode& node) -{ - fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; - - const auto ret = node.info.dynamic_type->get_descriptor(type_descriptor); - if (ret != fastdds::dds::RETCODE_OK) - { - throw utils::InconsistencyException("No Type Descriptor, failed to convert union to string"); - } - - os << "union " << node.info.type_kind_name << " switch (" << type_kind_to_str( - type_descriptor->discriminator_type()) << ")" << TYPE_OPENING; - - std::map members; - - node.info.dynamic_type->get_all_members(members); // WARNING: Default case not included in this collection, and currently not available - - for (const auto& member : members) - { - fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; - - const auto ret = member.second->get_descriptor(member_descriptor); - if (ret != fastdds::dds::RETCODE_OK) - { - throw utils::InconsistencyException("No Member Descriptor"); - } - - auto labels = member_descriptor->label(); // WARNING: There might be casting issues as discriminant type is currently not taken into consideration - - bool first_iter = true; - for (const auto& label : labels) - { - if (first_iter) - { - os << TAB_SEPARATOR; - } - else - { - os << " "; - } - first_iter = false; - - os << "case " << std::to_string(label) << ":"; - } - - os << "\n" << TAB_SEPARATOR << TAB_SEPARATOR << type_kind_to_str(member_descriptor->type()) << - " " << member.second->get_name() << ";\n"; - - - } - - // Close definition - os << TYPE_CLOSURE; - - return os; -} - -std::string generate_dyn_type_schema_from_tree( - const utils::TreeNode& parent_node) -{ - std::set types_written; - - std::stringstream ss; - - // For every Node, check if it is of a "writable" type (i.e. struct, enum or union). - // If it is, check if it is not yet written - // If it is not, write it down - for (const auto& node : parent_node.all_nodes()) - { - auto kind = node.info.dynamic_type->get_kind(); - if (types_written.find(node.info.type_kind_name) == types_written.end()) - { - switch (kind) - { - case fastdds::dds::xtypes::TK_STRUCTURE: - struct_to_str(ss, node); - break; - - case fastdds::dds::xtypes::TK_ENUM: - enum_to_str(ss, node); - break; - - case fastdds::dds::xtypes::TK_UNION: - union_to_str(ss, node); - break; - - default: - continue; - } - ss << "\n"; // Introduce blank line between type definitions - types_written.insert(node.info.type_kind_name); - } - } - - // Write struct parent node at last, after all its dependencies - // NOTE: not a requirement for Foxglove IDL Parser, dependencies can be placed after parent - struct_to_str(ss, parent_node); - - return ss.str(); -} - -std::string generate_idl_schema( - const fastdds::dds::DynamicType::_ref_type& dynamic_type) -{ - // Generate type tree - utils::TreeNode parent_type = generate_dyn_type_tree(dynamic_type); - - // From tree, generate string - return generate_dyn_type_schema_from_tree(parent_type); -} - -} /* namespace idl */ -} /* namespace types */ -} /* namespace core */ -} /* namespace ddspipe */ -} /* namespace eprosima */ diff --git a/ddspipe_core/test/unittest/types/CMakeLists.txt b/ddspipe_core/test/unittest/types/CMakeLists.txt index 94acaa2b..6fbb0b16 100644 --- a/ddspipe_core/test/unittest/types/CMakeLists.txt +++ b/ddspipe_core/test/unittest/types/CMakeLists.txt @@ -12,6 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_subdirectory(dynamic_types) add_subdirectory(endpoint) add_subdirectory(topic) diff --git a/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt b/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt deleted file mode 100644 index d3308625..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright 2021 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. - -#################### -# dtypes_idl_tests # -#################### - -set(TEST_NAME dtypes_idl_tests) - -# Add to test sources every FastDDSGen file generated -file(GLOB DATATYPE_SOURCES_CXX "types/**/*.cxx") -set(TEST_SOURCES - dtypes_idl_tests.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/types/dynamic_types/schema_idl.cpp - ${DATATYPE_SOURCES_CXX} - ) - -set(TEST_LIST - ) - -set(TEST_EXTRA_LIBRARIES - fastcdr - fastdds - cpp_utils - $<$:iphlpapi$Shlwapi> - ) - -# Add to needed sources every .idl file -file( - GLOB - RESULT_SOURCES_IDL - RELATIVE - "${CMAKE_CURRENT_SOURCE_DIR}" - "types/idls/*.idl") - -set(TEST_NEEDED_SOURCES - ${RESULT_SOURCES_IDL} - ) - -add_unittest_executable( - "${TEST_NAME}" - "${TEST_SOURCES}" - "${TEST_LIST}" - "${TEST_EXTRA_LIBRARIES}" - "${TEST_NEEDED_SOURCES}" - ) - -#################### -# dtypes_msg_tests # -#################### - -set(TEST_NAME dtypes_msg_tests) - -# Add to test sources every FastDDSGen file generated -file(GLOB DATATYPE_SOURCES_CXX "types/**/*.cxx") -set(TEST_SOURCES - dtypes_msg_tests.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/types/dynamic_types/schema_msg.cpp - ${DATATYPE_SOURCES_CXX} - ) - -set(TEST_LIST - ) - -set(TEST_EXTRA_LIBRARIES - fastcdr - fastdds - cpp_utils - $<$:iphlpapi$Shlwapi> - ) - -# Add to needed sources every .msg file -file( - GLOB - RESULT_SOURCES_MSG - RELATIVE - "${CMAKE_CURRENT_SOURCE_DIR}" - "types/msgs/*.msg") - -set(TEST_NEEDED_SOURCES - ${RESULT_SOURCES_MSG} - ) - -add_unittest_executable( - "${TEST_NAME}" - "${TEST_SOURCES}" - "${TEST_LIST}" - "${TEST_EXTRA_LIBRARIES}" - "${TEST_NEEDED_SOURCES}" - ) diff --git a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp deleted file mode 100644 index c4c15009..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_idl_tests.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2021 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. - -#include - -#include -#include - -#include -#include - -#include - -#include - -#include "types/all_types.hpp" - -using namespace eprosima; - -namespace test { - -std::string read_idl_from_file_( - const std::string& file_name) -{ - return utils::file_to_string(file_name.c_str()); -} - -std::string file_name_by_type( - SupportedType type) -{ - return std::string("types/idls/") + to_string(type) + ".idl"; -} - -void compare_schemas( - const std::string& schema1, - const std::string& schema2) -{ - ASSERT_EQ(schema1, schema2); -} - -void execute_test_by_type( - SupportedType type) -{ - // Get IDL file in string with the value expected to be generated in the schema - std::string idl_file = read_idl_from_file_(file_name_by_type(type)); - - // Get Dynamic type - fastdds::dds::DynamicType::_ref_type dyn_type = get_dynamic_type(type); - - // Get schema generated - std::string schema = ddspipe::core::types::idl::generate_idl_schema(dyn_type); - - // Compare schemas - compare_schemas(idl_file, schema); -} - -} // namespace test - -class ParametrizedTests : public ::testing::TestWithParam -{ -public: - - void SetUp() - { - type_ = GetParam(); - } - - test::SupportedType type_; -}; - -/** - * TODO - */ -TEST_P(ParametrizedTests, msg_schema_generation) -{ - test::execute_test_by_type(type_); -} - -INSTANTIATE_TEST_SUITE_P(dtypes_idl_tests, ParametrizedTests, ::testing::Values( - test::SupportedType::hello_world, - test::SupportedType::numeric_array, - test::SupportedType::char_sequence, - test::SupportedType::basic_struct, - test::SupportedType::basic_array_struct, - test::SupportedType::float_bounded_sequence, - test::SupportedType::arrays_and_sequences, - test::SupportedType::complex_nested_arrays, - test::SupportedType::enum_struct, - test::SupportedType::union_struct, - test::SupportedType::map_struct - )); - -int main( - int argc, - char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp deleted file mode 100644 index 751fdcf9..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2023 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. - -#include -#include -#include -#include -#include -#include -#include -#include "types/all_types.hpp" - -using namespace eprosima; - -namespace test { - -std::string read_msg_from_file_( - const std::string& file_name) -{ - return utils::file_to_string(file_name.c_str()); -} - -std::string file_name_by_type( - SupportedType type) -{ - return std::string("types/msgs/") + to_string(type) + ".msg"; -} - -void compare_schemas( - const std::string& schema1, - const std::string& schema2) -{ - ASSERT_EQ(schema1, schema2); -} - -void execute_test_by_type( - SupportedType type) -{ - // Get msg file in string with the value expected to be generated in the schema - std::string msg_file = read_msg_from_file_(file_name_by_type(type)); - - // Get Dynamic type - fastdds::dds::DynamicType::_ref_type dyn_type = get_dynamic_type(type); - - // Get schema generated - std::string schema = ddspipe::core::types::msg::generate_ros2_schema(dyn_type); - - // Compare schemas - compare_schemas(msg_file, schema); -} - -} // namespace test - -class ParametrizedTests : public ::testing::TestWithParam -{ -public: - - void SetUp() - { - type_ = GetParam(); - } - - test::SupportedType type_; -}; - -/** - * TODO - */ -TEST_P(ParametrizedTests, msg_schema_generation) -{ - test::execute_test_by_type(type_); -} - -INSTANTIATE_TEST_SUITE_P(dtypes_msg_tests, ParametrizedTests, ::testing::Values( - test::SupportedType::hello_world, - test::SupportedType::numeric_array, - test::SupportedType::char_sequence, - test::SupportedType::basic_struct, - test::SupportedType::basic_array_struct, - test::SupportedType::float_bounded_sequence, - test::SupportedType::arrays_and_sequences, - test::SupportedType::complex_nested_arrays - )); - -int main( - int argc, - char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp deleted file mode 100644 index 98eba88b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2022 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 all_types.hpp - */ - -/* - * USEFUL COMMAND - * - * for TYPE in hello_world numeric_array char_sequence basic_struct basic_array_struct float_bounded_sequence arrays_and_sequences complex_nested_arrays; do ${FASTDDSGEN_WS}/scripts/fastddsgen -replace -d ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/type_objects/ -typeobject -cs ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/idls/${TYPE}.idl; done - */ - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "type_objects/arrays_and_sequences.hpp" -#include "type_objects/arrays_and_sequencesPubSubTypes.hpp" - -#include "type_objects/basic_array_struct.hpp" -#include "type_objects/basic_array_structPubSubTypes.hpp" - -#include "type_objects/basic_struct.hpp" -#include "type_objects/basic_structPubSubTypes.hpp" - -#include "type_objects/char_sequence.hpp" -#include "type_objects/char_sequencePubSubTypes.hpp" - -#include "type_objects/complex_nested_arrays.hpp" -#include "type_objects/complex_nested_arraysPubSubTypes.hpp" - -#include "type_objects/enum_struct.hpp" -#include "type_objects/enum_structPubSubTypes.hpp" - -#include "type_objects/float_bounded_sequence.hpp" -#include "type_objects/float_bounded_sequencePubSubTypes.hpp" - -#include "type_objects/hello_world.hpp" -#include "type_objects/hello_worldPubSubTypes.hpp" - -#include "type_objects/map_struct.hpp" -#include "type_objects/map_structPubSubTypes.hpp" - -#include "type_objects/numeric_array.hpp" -#include "type_objects/numeric_arrayPubSubTypes.hpp" - -#include "type_objects/union_struct.hpp" -#include "type_objects/union_structPubSubTypes.hpp" - - -namespace test { - -ENUMERATION_BUILDER( - SupportedType, - hello_world, - numeric_array, - char_sequence, - basic_struct, - basic_array_struct, - float_bounded_sequence, - arrays_and_sequences, - complex_nested_arrays, - enum_struct, - union_struct, // NOTE: default case currently not supported in dynamic types - map_struct - ); - -eprosima::fastdds::dds::DynamicType::_ref_type get_dynamic_type( // traits::ref_type - SupportedType dyn_type) -{ - // Register the type - eprosima::fastdds::dds::TypeSupport type_arrays_and_sequences(new arrays_and_sequencesPubSubType()); - type_arrays_and_sequences->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_basic_array_struct(new basic_array_structPubSubType()); - type_basic_array_struct->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_basic_struct(new basic_structPubSubType()); - type_basic_struct->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_complex_nested_arrays(new complex_nested_arraysPubSubType()); - type_complex_nested_arrays->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_char_sequence(new char_sequencePubSubType()); - type_char_sequence->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_enum_struct(new enum_structPubSubType()); - type_enum_struct->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_float_bounded_sequence(new float_bounded_sequencePubSubType()); - type_float_bounded_sequence->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_hello_world(new hello_worldPubSubType()); - type_hello_world->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_map_struct(new map_structPubSubType()); - type_map_struct->register_type_object_representation(); - - eprosima::fastdds::dds::TypeSupport type_numeric_array(new numeric_arrayPubSubType()); - type_numeric_array->register_type_object_representation(); - - - eprosima::fastdds::dds::TypeSupport type_union_struct(new union_structPubSubType()); - type_union_struct->register_type_object_representation(); - - auto type_name = to_string(dyn_type); - - eprosima::fastdds::dds::xtypes::TypeObjectPair type_objs; - if (eprosima::fastdds::dds::RETCODE_OK == eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_objects( - type_name, - type_objs)) - { - return eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(type_objs.complete_type_object)->build(); - } - - else - { - throw eprosima::utils::InconsistencyException("No Type Object"); - } -} - -} /* namespace test */ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl deleted file mode 100644 index 5d9f9819..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl +++ /dev/null @@ -1,12 +0,0 @@ -struct AnInternalObject -{ - float x; - boolean positive; -}; - -struct arrays_and_sequences -{ - sequence unlimited_vector; - sequence limited_vector; - AnInternalObject limited_array[10]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl deleted file mode 100644 index b81e5956..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl +++ /dev/null @@ -1,11 +0,0 @@ -struct TheOtherObjectInArray -{ - long some_num; - boolean positive; -}; - -struct basic_array_struct -{ - unsigned long index; - TheOtherObjectInArray sub_structs[5]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl deleted file mode 100644 index da2ea1bb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl +++ /dev/null @@ -1,9 +0,0 @@ -struct TheOtherObject -{ - long some_num; -}; - -struct basic_struct -{ - TheOtherObject sub_struct; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl deleted file mode 100644 index 0abf7dd8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct char_sequence -{ - sequence chars; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl deleted file mode 100644 index b4eca21b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl +++ /dev/null @@ -1,23 +0,0 @@ -struct ThirdLevelElement -{ - double x; - double y; -}; - -struct SecondLevelElement -{ - ThirdLevelElement an_element_alone; - sequence a_limited_other_value; -}; - -struct FirstLevelElement -{ - string useless_name; - sequence sub; - ThirdLevelElement an_element_alone; -}; - -struct complex_nested_arrays -{ - FirstLevelElement array_of_elements[3]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/enum_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/enum_struct.idl deleted file mode 100644 index c40eae6e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/enum_struct.idl +++ /dev/null @@ -1,12 +0,0 @@ -enum ColorEnum -{ - RED, - GREEN, - BLUE -}; - -struct enum_struct -{ - unsigned long index; - ColorEnum enum_value; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl deleted file mode 100644 index b297df86..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct float_bounded_sequence -{ - sequence numbers; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl deleted file mode 100644 index d82036d8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl +++ /dev/null @@ -1,5 +0,0 @@ -struct hello_world -{ - unsigned long index; - string message; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/map_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/map_struct.idl deleted file mode 100644 index d4d19acb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/map_struct.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct map_struct -{ - map my_map; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl deleted file mode 100644 index 814abd59..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl +++ /dev/null @@ -1,4 +0,0 @@ -struct numeric_array -{ - long points[3]; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/union_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/union_struct.idl deleted file mode 100644 index 3967f961..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/union_struct.idl +++ /dev/null @@ -1,15 +0,0 @@ -union MyUnion switch (long) -{ - case 1: - octet octet_value; - case 2: - long long_value; - case 3: - string string_value; -}; - -struct union_struct -{ - unsigned long index; - MyUnion union_value; -}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg deleted file mode 100644 index 1942bc58..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg +++ /dev/null @@ -1,7 +0,0 @@ -AnInternalObject[] unlimited_vector -AnInternalObject[<=10] limited_vector -AnInternalObject[10] limited_array -================================================================================ -MSG: fastdds/AnInternalObject -float32 x -bool positive diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg deleted file mode 100644 index a012398a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg +++ /dev/null @@ -1,6 +0,0 @@ -uint32 index -TheOtherObjectInArray[5] sub_structs -================================================================================ -MSG: fastdds/TheOtherObjectInArray -int32 some_num -bool positive diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg deleted file mode 100644 index eb9814cb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg +++ /dev/null @@ -1,4 +0,0 @@ -TheOtherObject sub_struct -================================================================================ -MSG: fastdds/TheOtherObject -int32 some_num diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg deleted file mode 100644 index bf4b2456..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg +++ /dev/null @@ -1 +0,0 @@ -int8[] chars diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg deleted file mode 100644 index 5eebc2f4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg +++ /dev/null @@ -1,14 +0,0 @@ -FirstLevelElement[3] array_of_elements -================================================================================ -MSG: fastdds/ThirdLevelElement -float64 x -float64 y -================================================================================ -MSG: fastdds/SecondLevelElement -ThirdLevelElement an_element_alone -ThirdLevelElement[<=1] a_limited_other_value -================================================================================ -MSG: fastdds/FirstLevelElement -string useless_name -SecondLevelElement[] sub -ThirdLevelElement an_element_alone diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg deleted file mode 100644 index 77503c2e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg +++ /dev/null @@ -1 +0,0 @@ -float32[<=13] numbers diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg deleted file mode 100644 index 63e3fbcb..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg +++ /dev/null @@ -1,2 +0,0 @@ -uint32 index -string message diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg deleted file mode 100644 index d391c85d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg +++ /dev/null @@ -1 +0,0 @@ -int32[3] points diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp deleted file mode 100644 index e94655a4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp +++ /dev/null @@ -1,445 +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 arrays_and_sequences.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_HPP -#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_HPP - -#include -#include -#include -#include - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(ARRAYS_AND_SEQUENCES_SOURCE) -#define ARRAYS_AND_SEQUENCES_DllAPI __declspec( dllexport ) -#else -#define ARRAYS_AND_SEQUENCES_DllAPI __declspec( dllimport ) -#endif // ARRAYS_AND_SEQUENCES_SOURCE -#else -#define ARRAYS_AND_SEQUENCES_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define ARRAYS_AND_SEQUENCES_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure AnInternalObject defined by the user in the IDL file. - * @ingroup arrays_and_sequences - */ -class AnInternalObject -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport AnInternalObject() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~AnInternalObject() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject( - const AnInternalObject& x) - { - m_x = x.m_x; - - m_positive = x.m_positive; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject( - AnInternalObject&& x) noexcept - { - m_x = x.m_x; - m_positive = x.m_positive; - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject& operator =( - const AnInternalObject& x) - { - - m_x = x.m_x; - - m_positive = x.m_positive; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object AnInternalObject that will be copied. - */ - eProsima_user_DllExport AnInternalObject& operator =( - AnInternalObject&& x) noexcept - { - - m_x = x.m_x; - m_positive = x.m_positive; - return *this; - } - - /*! - * @brief Comparison operator. - * @param x AnInternalObject object to compare. - */ - eProsima_user_DllExport bool operator ==( - const AnInternalObject& x) const - { - return (m_x == x.m_x && - m_positive == x.m_positive); - } - - /*! - * @brief Comparison operator. - * @param x AnInternalObject object to compare. - */ - eProsima_user_DllExport bool operator !=( - const AnInternalObject& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ - eProsima_user_DllExport void x( - float _x) - { - m_x = _x; - } - - /*! - * @brief This function returns the value of member x - * @return Value of member x - */ - eProsima_user_DllExport float x() const - { - return m_x; - } - - /*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ - eProsima_user_DllExport float& x() - { - return m_x; - } - - - /*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ - eProsima_user_DllExport void positive( - bool _positive) - { - m_positive = _positive; - } - - /*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ - eProsima_user_DllExport bool positive() const - { - return m_positive; - } - - /*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ - eProsima_user_DllExport bool& positive() - { - return m_positive; - } - - - -private: - - float m_x{0.0}; - bool m_positive{false}; - -}; -/*! - * @brief This class represents the structure arrays_and_sequences defined by the user in the IDL file. - * @ingroup arrays_and_sequences - */ -class arrays_and_sequences -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport arrays_and_sequences() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~arrays_and_sequences() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences( - const arrays_and_sequences& x) - { - m_unlimited_vector = x.m_unlimited_vector; - - m_limited_vector = x.m_limited_vector; - - m_limited_array = x.m_limited_array; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences( - arrays_and_sequences&& x) noexcept - { - m_unlimited_vector = std::move(x.m_unlimited_vector); - m_limited_vector = std::move(x.m_limited_vector); - m_limited_array = std::move(x.m_limited_array); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences& operator =( - const arrays_and_sequences& x) - { - - m_unlimited_vector = x.m_unlimited_vector; - - m_limited_vector = x.m_limited_vector; - - m_limited_array = x.m_limited_array; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object arrays_and_sequences that will be copied. - */ - eProsima_user_DllExport arrays_and_sequences& operator =( - arrays_and_sequences&& x) noexcept - { - - m_unlimited_vector = std::move(x.m_unlimited_vector); - m_limited_vector = std::move(x.m_limited_vector); - m_limited_array = std::move(x.m_limited_array); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x arrays_and_sequences object to compare. - */ - eProsima_user_DllExport bool operator ==( - const arrays_and_sequences& x) const - { - return (m_unlimited_vector == x.m_unlimited_vector && - m_limited_vector == x.m_limited_vector && - m_limited_array == x.m_limited_array); - } - - /*! - * @brief Comparison operator. - * @param x arrays_and_sequences object to compare. - */ - eProsima_user_DllExport bool operator !=( - const arrays_and_sequences& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member unlimited_vector - * @param _unlimited_vector New value to be copied in member unlimited_vector - */ - eProsima_user_DllExport void unlimited_vector( - const std::vector& _unlimited_vector) - { - m_unlimited_vector = _unlimited_vector; - } - - /*! - * @brief This function moves the value in member unlimited_vector - * @param _unlimited_vector New value to be moved in member unlimited_vector - */ - eProsima_user_DllExport void unlimited_vector( - std::vector&& _unlimited_vector) - { - m_unlimited_vector = std::move(_unlimited_vector); - } - - /*! - * @brief This function returns a constant reference to member unlimited_vector - * @return Constant reference to member unlimited_vector - */ - eProsima_user_DllExport const std::vector& unlimited_vector() const - { - return m_unlimited_vector; - } - - /*! - * @brief This function returns a reference to member unlimited_vector - * @return Reference to member unlimited_vector - */ - eProsima_user_DllExport std::vector& unlimited_vector() - { - return m_unlimited_vector; - } - - - /*! - * @brief This function copies the value in member limited_vector - * @param _limited_vector New value to be copied in member limited_vector - */ - eProsima_user_DllExport void limited_vector( - const std::vector& _limited_vector) - { - m_limited_vector = _limited_vector; - } - - /*! - * @brief This function moves the value in member limited_vector - * @param _limited_vector New value to be moved in member limited_vector - */ - eProsima_user_DllExport void limited_vector( - std::vector&& _limited_vector) - { - m_limited_vector = std::move(_limited_vector); - } - - /*! - * @brief This function returns a constant reference to member limited_vector - * @return Constant reference to member limited_vector - */ - eProsima_user_DllExport const std::vector& limited_vector() const - { - return m_limited_vector; - } - - /*! - * @brief This function returns a reference to member limited_vector - * @return Reference to member limited_vector - */ - eProsima_user_DllExport std::vector& limited_vector() - { - return m_limited_vector; - } - - - /*! - * @brief This function copies the value in member limited_array - * @param _limited_array New value to be copied in member limited_array - */ - eProsima_user_DllExport void limited_array( - const std::array& _limited_array) - { - m_limited_array = _limited_array; - } - - /*! - * @brief This function moves the value in member limited_array - * @param _limited_array New value to be moved in member limited_array - */ - eProsima_user_DllExport void limited_array( - std::array&& _limited_array) - { - m_limited_array = std::move(_limited_array); - } - - /*! - * @brief This function returns a constant reference to member limited_array - * @return Constant reference to member limited_array - */ - eProsima_user_DllExport const std::array& limited_array() const - { - return m_limited_array; - } - - /*! - * @brief This function returns a reference to member limited_array - * @return Reference to member limited_array - */ - eProsima_user_DllExport std::array& limited_array() - { - return m_limited_array; - } - - - -private: - - std::vector m_unlimited_vector; - std::vector m_limited_vector; - std::array m_limited_array; - -}; - -#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp deleted file mode 100644 index d777ee1c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp +++ /dev/null @@ -1,53 +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 arrays_and_sequencesCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP -#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP - -#include "arrays_and_sequences.hpp" - -constexpr uint32_t arrays_and_sequences_max_cdr_typesize {261UL}; -constexpr uint32_t arrays_and_sequences_max_key_cdr_typesize {0UL}; - -constexpr uint32_t AnInternalObject_max_cdr_typesize {9UL}; -constexpr uint32_t AnInternalObject_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const AnInternalObject& data); - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const arrays_and_sequences& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp deleted file mode 100644 index 8a5c223f..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp +++ /dev/null @@ -1,218 +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 arrays_and_sequencesCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP -#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP - -#include "arrays_and_sequencesCdrAux.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 AnInternalObject& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.x(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.positive(), 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 AnInternalObject& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.x() - << eprosima::fastcdr::MemberId(1) << data.positive() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - AnInternalObject& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.x(); - break; - - case 1: - dcdr >> data.positive(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const AnInternalObject& data) -{ - static_cast(scdr); - static_cast(data); -} - - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const arrays_and_sequences& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.unlimited_vector(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.limited_vector(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.limited_array(), 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 arrays_and_sequences& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.unlimited_vector() - << eprosima::fastcdr::MemberId(1) << data.limited_vector() - << eprosima::fastcdr::MemberId(2) << data.limited_array() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - arrays_and_sequences& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.unlimited_vector(); - break; - - case 1: - dcdr >> data.limited_vector(); - break; - - case 2: - dcdr >> data.limited_array(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const arrays_and_sequences& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx deleted file mode 100644 index cd805263..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx +++ /dev/null @@ -1,422 +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 arrays_and_sequencesPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "arrays_and_sequencesPubSubTypes.hpp" - -#include -#include - -#include "arrays_and_sequencesCdrAux.hpp" -#include "arrays_and_sequencesTypeObjectSupport.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; - -AnInternalObjectPubSubType::AnInternalObjectPubSubType() -{ - setName("AnInternalObject"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(AnInternalObject::getMaxCdrSerializedSize()); -#else - AnInternalObject_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = AnInternalObject_max_key_cdr_typesize > 16 ? AnInternalObject_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -AnInternalObjectPubSubType::~AnInternalObjectPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool AnInternalObjectPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const AnInternalObject* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool AnInternalObjectPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - AnInternalObject* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function AnInternalObjectPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* AnInternalObjectPubSubType::createData() -{ - return reinterpret_cast(new AnInternalObject()); -} - -void AnInternalObjectPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool AnInternalObjectPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const AnInternalObject* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - AnInternalObject_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || AnInternalObject_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void AnInternalObjectPubSubType::register_type_object_representation() -{ - register_AnInternalObject_type_identifier(type_identifiers_); -} - -arrays_and_sequencesPubSubType::arrays_and_sequencesPubSubType() -{ - setName("arrays_and_sequences"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(arrays_and_sequences::getMaxCdrSerializedSize()); -#else - arrays_and_sequences_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = arrays_and_sequences_max_key_cdr_typesize > 16 ? arrays_and_sequences_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -arrays_and_sequencesPubSubType::~arrays_and_sequencesPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool arrays_and_sequencesPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const arrays_and_sequences* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool arrays_and_sequencesPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - arrays_and_sequences* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function arrays_and_sequencesPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* arrays_and_sequencesPubSubType::createData() -{ - return reinterpret_cast(new arrays_and_sequences()); -} - -void arrays_and_sequencesPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool arrays_and_sequencesPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const arrays_and_sequences* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - arrays_and_sequences_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || arrays_and_sequences_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void arrays_and_sequencesPubSubType::register_type_object_representation() -{ - register_arrays_and_sequences_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "arrays_and_sequencesCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp deleted file mode 100644 index 4b3677a4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp +++ /dev/null @@ -1,224 +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 arrays_and_sequencesPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "arrays_and_sequences.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated arrays_and_sequences is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type AnInternalObject defined by the user in the IDL file. - * @ingroup arrays_and_sequences - */ -class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef AnInternalObject type; - - eProsima_user_DllExport AnInternalObjectPubSubType(); - - eProsima_user_DllExport ~AnInternalObjectPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -/*! - * @brief This class represents the TopicDataType of the type arrays_and_sequences defined by the user in the IDL file. - * @ingroup arrays_and_sequences - */ -class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef arrays_and_sequences type; - - eProsima_user_DllExport arrays_and_sequencesPubSubType(); - - eProsima_user_DllExport ~arrays_and_sequencesPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx deleted file mode 100644 index 06defd21..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx +++ /dev/null @@ -1,341 +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 arrays_and_sequencesTypeObjectSupport.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. - */ - -#include "arrays_and_sequencesTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "arrays_and_sequences.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_AnInternalObject_type_identifier( - TypeIdentifierPair& type_ids_AnInternalObject) -{ - - ReturnCode_t return_code_AnInternalObject {eprosima::fastdds::dds::RETCODE_OK}; - return_code_AnInternalObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_AnInternalObject); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_AnInternalObject) - { - StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; - eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; - eprosima::fastcdr::optional ann_custom_AnInternalObject; - CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); - CompleteStructHeader header_AnInternalObject; - header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); - CompleteStructMemberSeq member_seq_AnInternalObject; - { - TypeIdentifierPair type_ids_x; - ReturnCode_t return_code_x {eprosima::fastdds::dds::RETCODE_OK}; - return_code_x = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_float", type_ids_x); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_x) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_x = 0x00000000; - bool common_x_ec {false}; - CommonStructMember common_x {TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_x, common_x_ec))}; - if (!common_x_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); - } - { - TypeIdentifierPair type_ids_positive; - ReturnCode_t return_code_positive {eprosima::fastdds::dds::RETCODE_OK}; - return_code_positive = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_positive); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_positive) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_positive = 0x00000001; - bool common_positive_ec {false}; - CommonStructMember common_positive {TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_positive, common_positive_ec))}; - if (!common_positive_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure positive member TypeIdentifier inconsistent."); - return; - } - MemberName name_positive = "positive"; - eprosima::fastcdr::optional member_ann_builtin_positive; - ann_custom_AnInternalObject.reset(); - CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); - CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); - TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); - } - CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string(), type_ids_AnInternalObject)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "AnInternalObject already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_arrays_and_sequences_type_identifier( - TypeIdentifierPair& type_ids_arrays_and_sequences) -{ - - ReturnCode_t return_code_arrays_and_sequences {eprosima::fastdds::dds::RETCODE_OK}; - return_code_arrays_and_sequences = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "arrays_and_sequences", type_ids_arrays_and_sequences); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_arrays_and_sequences) - { - StructTypeFlag struct_flags_arrays_and_sequences = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_arrays_and_sequences = "arrays_and_sequences"; - eprosima::fastcdr::optional type_ann_builtin_arrays_and_sequences; - eprosima::fastcdr::optional ann_custom_arrays_and_sequences; - CompleteTypeDetail detail_arrays_and_sequences = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_arrays_and_sequences, ann_custom_arrays_and_sequences, type_name_arrays_and_sequences.to_string()); - CompleteStructHeader header_arrays_and_sequences; - header_arrays_and_sequences = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_arrays_and_sequences); - CompleteStructMemberSeq member_seq_arrays_and_sequences; - { - TypeIdentifierPair type_ids_unlimited_vector; - ReturnCode_t return_code_unlimited_vector {eprosima::fastdds::dds::RETCODE_OK}; - return_code_unlimited_vector = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_AnInternalObject_unbounded", type_ids_unlimited_vector); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_unlimited_vector) - { - return_code_unlimited_vector = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_unlimited_vector); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_unlimited_vector) - { - ::register_AnInternalObject_type_identifier(type_ids_unlimited_vector); - } - bool element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec {false}; - TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_unlimited_vector, element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec))}; - if (!element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_unlimited_vector.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_unbounded = 0; - PlainCollectionHeader header_anonymous_sequence_AnInternalObject_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_unbounded, element_flags_anonymous_sequence_AnInternalObject_unbounded); - { - SBound bound = 0; - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_unbounded", type_ids_unlimited_vector)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_AnInternalObject_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_unlimited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_unlimited_vector = 0x00000000; - bool common_unlimited_vector_ec {false}; - CommonStructMember common_unlimited_vector {TypeObjectUtils::build_common_struct_member(member_id_unlimited_vector, member_flags_unlimited_vector, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_unlimited_vector, common_unlimited_vector_ec))}; - if (!common_unlimited_vector_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure unlimited_vector member TypeIdentifier inconsistent."); - return; - } - MemberName name_unlimited_vector = "unlimited_vector"; - eprosima::fastcdr::optional member_ann_builtin_unlimited_vector; - ann_custom_arrays_and_sequences.reset(); - CompleteMemberDetail detail_unlimited_vector = TypeObjectUtils::build_complete_member_detail(name_unlimited_vector, member_ann_builtin_unlimited_vector, ann_custom_arrays_and_sequences); - CompleteStructMember member_unlimited_vector = TypeObjectUtils::build_complete_struct_member(common_unlimited_vector, detail_unlimited_vector); - TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_unlimited_vector); - } - { - TypeIdentifierPair type_ids_limited_vector; - ReturnCode_t return_code_limited_vector {eprosima::fastdds::dds::RETCODE_OK}; - return_code_limited_vector = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_AnInternalObject_10", type_ids_limited_vector); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_vector) - { - return_code_limited_vector = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_limited_vector); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_vector) - { - ::register_AnInternalObject_type_identifier(type_ids_limited_vector); - } - bool element_identifier_anonymous_sequence_AnInternalObject_10_ec {false}; - TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_10 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_vector, element_identifier_anonymous_sequence_AnInternalObject_10_ec))}; - if (!element_identifier_anonymous_sequence_AnInternalObject_10_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_COMPLETE; - if (TK_NONE == type_ids_limited_vector.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_10 = 0; - PlainCollectionHeader header_anonymous_sequence_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_10, element_flags_anonymous_sequence_AnInternalObject_10); - { - SBound bound = static_cast(10); - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_10, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_10)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_10", type_ids_limited_vector)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_limited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_limited_vector = 0x00000001; - bool common_limited_vector_ec {false}; - CommonStructMember common_limited_vector {TypeObjectUtils::build_common_struct_member(member_id_limited_vector, member_flags_limited_vector, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_vector, common_limited_vector_ec))}; - if (!common_limited_vector_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure limited_vector member TypeIdentifier inconsistent."); - return; - } - MemberName name_limited_vector = "limited_vector"; - eprosima::fastcdr::optional member_ann_builtin_limited_vector; - ann_custom_arrays_and_sequences.reset(); - CompleteMemberDetail detail_limited_vector = TypeObjectUtils::build_complete_member_detail(name_limited_vector, member_ann_builtin_limited_vector, ann_custom_arrays_and_sequences); - CompleteStructMember member_limited_vector = TypeObjectUtils::build_complete_struct_member(common_limited_vector, detail_limited_vector); - TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_limited_vector); - } - { - TypeIdentifierPair type_ids_limited_array; - ReturnCode_t return_code_limited_array {eprosima::fastdds::dds::RETCODE_OK}; - return_code_limited_array = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_AnInternalObject_10", type_ids_limited_array); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_array) - { - return_code_limited_array = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "AnInternalObject", type_ids_limited_array); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_array) - { - ::register_AnInternalObject_type_identifier(type_ids_limited_array); - } - bool element_identifier_anonymous_array_AnInternalObject_10_ec {false}; - TypeIdentifier* element_identifier_anonymous_array_AnInternalObject_10 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_array, element_identifier_anonymous_array_AnInternalObject_10_ec))}; - if (!element_identifier_anonymous_array_AnInternalObject_10_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_array_AnInternalObject_10 = EK_COMPLETE; - if (TK_NONE == type_ids_limited_array.type_identifier2()._d()) - { - equiv_kind_anonymous_array_AnInternalObject_10 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_array_AnInternalObject_10 = 0; - PlainCollectionHeader header_anonymous_array_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_AnInternalObject_10, element_flags_anonymous_array_AnInternalObject_10); - { - SBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(10)); - - PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_AnInternalObject_10, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_AnInternalObject_10)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_AnInternalObject_10", type_ids_limited_array)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_limited_array = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_limited_array = 0x00000002; - bool common_limited_array_ec {false}; - CommonStructMember common_limited_array {TypeObjectUtils::build_common_struct_member(member_id_limited_array, member_flags_limited_array, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_array, common_limited_array_ec))}; - if (!common_limited_array_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure limited_array member TypeIdentifier inconsistent."); - return; - } - MemberName name_limited_array = "limited_array"; - eprosima::fastcdr::optional member_ann_builtin_limited_array; - ann_custom_arrays_and_sequences.reset(); - CompleteMemberDetail detail_limited_array = TypeObjectUtils::build_complete_member_detail(name_limited_array, member_ann_builtin_limited_array, ann_custom_arrays_and_sequences); - CompleteStructMember member_limited_array = TypeObjectUtils::build_complete_struct_member(common_limited_array, detail_limited_array); - TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_limited_array); - } - CompleteStructType struct_type_arrays_and_sequences = TypeObjectUtils::build_complete_struct_type(struct_flags_arrays_and_sequences, header_arrays_and_sequences, member_seq_arrays_and_sequences); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_arrays_and_sequences, type_name_arrays_and_sequences.to_string(), type_ids_arrays_and_sequences)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "arrays_and_sequences already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp deleted file mode 100644 index 43f145f3..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp +++ /dev/null @@ -1,68 +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 arrays_and_sequencesTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_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 - -/** - * @brief Register AnInternalObject related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_AnInternalObject_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register arrays_and_sequences related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_arrays_and_sequences_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp deleted file mode 100644 index 1352a2e4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp +++ /dev/null @@ -1,386 +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 basic_array_struct.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_HPP -#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_HPP - -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(BASIC_ARRAY_STRUCT_SOURCE) -#define BASIC_ARRAY_STRUCT_DllAPI __declspec( dllexport ) -#else -#define BASIC_ARRAY_STRUCT_DllAPI __declspec( dllimport ) -#endif // BASIC_ARRAY_STRUCT_SOURCE -#else -#define BASIC_ARRAY_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define BASIC_ARRAY_STRUCT_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure TheOtherObjectInArray defined by the user in the IDL file. - * @ingroup basic_array_struct - */ -class TheOtherObjectInArray -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport TheOtherObjectInArray() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~TheOtherObjectInArray() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray( - const TheOtherObjectInArray& x) - { - m_some_num = x.m_some_num; - - m_positive = x.m_positive; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray( - TheOtherObjectInArray&& x) noexcept - { - m_some_num = x.m_some_num; - m_positive = x.m_positive; - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray& operator =( - const TheOtherObjectInArray& x) - { - - m_some_num = x.m_some_num; - - m_positive = x.m_positive; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object TheOtherObjectInArray that will be copied. - */ - eProsima_user_DllExport TheOtherObjectInArray& operator =( - TheOtherObjectInArray&& x) noexcept - { - - m_some_num = x.m_some_num; - m_positive = x.m_positive; - return *this; - } - - /*! - * @brief Comparison operator. - * @param x TheOtherObjectInArray object to compare. - */ - eProsima_user_DllExport bool operator ==( - const TheOtherObjectInArray& x) const - { - return (m_some_num == x.m_some_num && - m_positive == x.m_positive); - } - - /*! - * @brief Comparison operator. - * @param x TheOtherObjectInArray object to compare. - */ - eProsima_user_DllExport bool operator !=( - const TheOtherObjectInArray& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ - eProsima_user_DllExport void some_num( - int32_t _some_num) - { - m_some_num = _some_num; - } - - /*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ - eProsima_user_DllExport int32_t some_num() const - { - return m_some_num; - } - - /*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ - eProsima_user_DllExport int32_t& some_num() - { - return m_some_num; - } - - - /*! - * @brief This function sets a value in member positive - * @param _positive New value for member positive - */ - eProsima_user_DllExport void positive( - bool _positive) - { - m_positive = _positive; - } - - /*! - * @brief This function returns the value of member positive - * @return Value of member positive - */ - eProsima_user_DllExport bool positive() const - { - return m_positive; - } - - /*! - * @brief This function returns a reference to member positive - * @return Reference to member positive - */ - eProsima_user_DllExport bool& positive() - { - return m_positive; - } - - - -private: - - int32_t m_some_num{0}; - bool m_positive{false}; - -}; -/*! - * @brief This class represents the structure basic_array_struct defined by the user in the IDL file. - * @ingroup basic_array_struct - */ -class basic_array_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport basic_array_struct() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~basic_array_struct() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct( - const basic_array_struct& x) - { - m_index = x.m_index; - - m_sub_structs = x.m_sub_structs; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct( - basic_array_struct&& x) noexcept - { - m_index = x.m_index; - m_sub_structs = std::move(x.m_sub_structs); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct& operator =( - const basic_array_struct& x) - { - - m_index = x.m_index; - - m_sub_structs = x.m_sub_structs; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object basic_array_struct that will be copied. - */ - eProsima_user_DllExport basic_array_struct& operator =( - basic_array_struct&& x) noexcept - { - - m_index = x.m_index; - m_sub_structs = std::move(x.m_sub_structs); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x basic_array_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const basic_array_struct& x) const - { - return (m_index == x.m_index && - m_sub_structs == x.m_sub_structs); - } - - /*! - * @brief Comparison operator. - * @param x basic_array_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const basic_array_struct& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index) - { - m_index = _index; - } - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const - { - return m_index; - } - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index() - { - return m_index; - } - - - /*! - * @brief This function copies the value in member sub_structs - * @param _sub_structs New value to be copied in member sub_structs - */ - eProsima_user_DllExport void sub_structs( - const std::array& _sub_structs) - { - m_sub_structs = _sub_structs; - } - - /*! - * @brief This function moves the value in member sub_structs - * @param _sub_structs New value to be moved in member sub_structs - */ - eProsima_user_DllExport void sub_structs( - std::array&& _sub_structs) - { - m_sub_structs = std::move(_sub_structs); - } - - /*! - * @brief This function returns a constant reference to member sub_structs - * @return Constant reference to member sub_structs - */ - eProsima_user_DllExport const std::array& sub_structs() const - { - return m_sub_structs; - } - - /*! - * @brief This function returns a reference to member sub_structs - * @return Reference to member sub_structs - */ - eProsima_user_DllExport std::array& sub_structs() - { - return m_sub_structs; - } - - - -private: - - uint32_t m_index{0}; - std::array m_sub_structs; - -}; - -#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp deleted file mode 100644 index 3bbf1a9a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp +++ /dev/null @@ -1,53 +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 basic_array_structCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP -#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP - -#include "basic_array_struct.hpp" - -constexpr uint32_t basic_array_struct_max_cdr_typesize {69UL}; -constexpr uint32_t basic_array_struct_max_key_cdr_typesize {0UL}; - -constexpr uint32_t TheOtherObjectInArray_max_cdr_typesize {9UL}; -constexpr uint32_t TheOtherObjectInArray_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const TheOtherObjectInArray& data); - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const basic_array_struct& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp deleted file mode 100644 index ebd5483e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp +++ /dev/null @@ -1,210 +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 basic_array_structCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP -#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP - -#include "basic_array_structCdrAux.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 TheOtherObjectInArray& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.some_num(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.positive(), 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 TheOtherObjectInArray& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.some_num() - << eprosima::fastcdr::MemberId(1) << data.positive() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - TheOtherObjectInArray& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.some_num(); - break; - - case 1: - dcdr >> data.positive(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const TheOtherObjectInArray& data) -{ - static_cast(scdr); - static_cast(data); -} - - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const basic_array_struct& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.index(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.sub_structs(), 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 basic_array_struct& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.index() - << eprosima::fastcdr::MemberId(1) << data.sub_structs() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - basic_array_struct& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.index(); - break; - - case 1: - dcdr >> data.sub_structs(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const basic_array_struct& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx deleted file mode 100644 index 88043626..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx +++ /dev/null @@ -1,422 +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 basic_array_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "basic_array_structPubSubTypes.hpp" - -#include -#include - -#include "basic_array_structCdrAux.hpp" -#include "basic_array_structTypeObjectSupport.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; - -TheOtherObjectInArrayPubSubType::TheOtherObjectInArrayPubSubType() -{ - setName("TheOtherObjectInArray"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(TheOtherObjectInArray::getMaxCdrSerializedSize()); -#else - TheOtherObjectInArray_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = TheOtherObjectInArray_max_key_cdr_typesize > 16 ? TheOtherObjectInArray_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -TheOtherObjectInArrayPubSubType::~TheOtherObjectInArrayPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool TheOtherObjectInArrayPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const TheOtherObjectInArray* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool TheOtherObjectInArrayPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - TheOtherObjectInArray* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function TheOtherObjectInArrayPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* TheOtherObjectInArrayPubSubType::createData() -{ - return reinterpret_cast(new TheOtherObjectInArray()); -} - -void TheOtherObjectInArrayPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool TheOtherObjectInArrayPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const TheOtherObjectInArray* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - TheOtherObjectInArray_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || TheOtherObjectInArray_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void TheOtherObjectInArrayPubSubType::register_type_object_representation() -{ - register_TheOtherObjectInArray_type_identifier(type_identifiers_); -} - -basic_array_structPubSubType::basic_array_structPubSubType() -{ - setName("basic_array_struct"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(basic_array_struct::getMaxCdrSerializedSize()); -#else - basic_array_struct_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = basic_array_struct_max_key_cdr_typesize > 16 ? basic_array_struct_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -basic_array_structPubSubType::~basic_array_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool basic_array_structPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const basic_array_struct* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool basic_array_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - basic_array_struct* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function basic_array_structPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* basic_array_structPubSubType::createData() -{ - return reinterpret_cast(new basic_array_struct()); -} - -void basic_array_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool basic_array_structPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const basic_array_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - basic_array_struct_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || basic_array_struct_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void basic_array_structPubSubType::register_type_object_representation() -{ - register_basic_array_struct_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "basic_array_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp deleted file mode 100644 index 057e6dda..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp +++ /dev/null @@ -1,224 +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 basic_array_structPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "basic_array_struct.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated basic_array_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type TheOtherObjectInArray defined by the user in the IDL file. - * @ingroup basic_array_struct - */ -class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef TheOtherObjectInArray type; - - eProsima_user_DllExport TheOtherObjectInArrayPubSubType(); - - eProsima_user_DllExport ~TheOtherObjectInArrayPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -/*! - * @brief This class represents the TopicDataType of the type basic_array_struct defined by the user in the IDL file. - * @ingroup basic_array_struct - */ -class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef basic_array_struct type; - - eProsima_user_DllExport basic_array_structPubSubType(); - - eProsima_user_DllExport ~basic_array_structPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx deleted file mode 100644 index 242ea811..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx +++ /dev/null @@ -1,251 +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 basic_array_structTypeObjectSupport.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. - */ - -#include "basic_array_structTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "basic_array_struct.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_TheOtherObjectInArray_type_identifier( - TypeIdentifierPair& type_ids_TheOtherObjectInArray) -{ - - ReturnCode_t return_code_TheOtherObjectInArray {eprosima::fastdds::dds::RETCODE_OK}; - return_code_TheOtherObjectInArray = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObjectInArray) - { - StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_TheOtherObjectInArray = "TheOtherObjectInArray"; - eprosima::fastcdr::optional type_ann_builtin_TheOtherObjectInArray; - eprosima::fastcdr::optional ann_custom_TheOtherObjectInArray; - CompleteTypeDetail detail_TheOtherObjectInArray = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObjectInArray, ann_custom_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string()); - CompleteStructHeader header_TheOtherObjectInArray; - header_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObjectInArray); - CompleteStructMemberSeq member_seq_TheOtherObjectInArray; - { - TypeIdentifierPair type_ids_some_num; - ReturnCode_t return_code_some_num {eprosima::fastdds::dds::RETCODE_OK}; - return_code_some_num = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_some_num); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_some_num) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_some_num = 0x00000000; - bool common_some_num_ec {false}; - CommonStructMember common_some_num {TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_some_num, common_some_num_ec))}; - if (!common_some_num_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure some_num member TypeIdentifier inconsistent."); - return; - } - MemberName name_some_num = "some_num"; - eprosima::fastcdr::optional member_ann_builtin_some_num; - ann_custom_TheOtherObjectInArray.reset(); - CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObjectInArray); - CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); - TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_some_num); - } - { - TypeIdentifierPair type_ids_positive; - ReturnCode_t return_code_positive {eprosima::fastdds::dds::RETCODE_OK}; - return_code_positive = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_positive); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_positive) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_positive = 0x00000001; - bool common_positive_ec {false}; - CommonStructMember common_positive {TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_positive, common_positive_ec))}; - if (!common_positive_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure positive member TypeIdentifier inconsistent."); - return; - } - MemberName name_positive = "positive"; - eprosima::fastcdr::optional member_ann_builtin_positive; - ann_custom_TheOtherObjectInArray.reset(); - CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_TheOtherObjectInArray); - CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); - TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_positive); - } - CompleteStructType struct_type_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObjectInArray, header_TheOtherObjectInArray, member_seq_TheOtherObjectInArray); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string(), type_ids_TheOtherObjectInArray)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObjectInArray already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_basic_array_struct_type_identifier( - TypeIdentifierPair& type_ids_basic_array_struct) -{ - - ReturnCode_t return_code_basic_array_struct {eprosima::fastdds::dds::RETCODE_OK}; - return_code_basic_array_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "basic_array_struct", type_ids_basic_array_struct); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_array_struct) - { - StructTypeFlag struct_flags_basic_array_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_basic_array_struct = "basic_array_struct"; - eprosima::fastcdr::optional type_ann_builtin_basic_array_struct; - eprosima::fastcdr::optional ann_custom_basic_array_struct; - CompleteTypeDetail detail_basic_array_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_basic_array_struct, ann_custom_basic_array_struct, type_name_basic_array_struct.to_string()); - CompleteStructHeader header_basic_array_struct; - header_basic_array_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_array_struct); - CompleteStructMemberSeq member_seq_basic_array_struct; - { - TypeIdentifierPair type_ids_index; - ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; - return_code_index = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_index); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_index = 0x00000000; - bool common_index_ec {false}; - CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; - if (!common_index_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); - return; - } - MemberName name_index = "index"; - eprosima::fastcdr::optional member_ann_builtin_index; - ann_custom_basic_array_struct.reset(); - CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_basic_array_struct); - CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); - TypeObjectUtils::add_complete_struct_member(member_seq_basic_array_struct, member_index); - } - { - TypeIdentifierPair type_ids_sub_structs; - ReturnCode_t return_code_sub_structs {eprosima::fastdds::dds::RETCODE_OK}; - return_code_sub_structs = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_TheOtherObjectInArray_5", type_ids_sub_structs); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_structs) - { - return_code_sub_structs = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObjectInArray", type_ids_sub_structs); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_structs) - { - ::register_TheOtherObjectInArray_type_identifier(type_ids_sub_structs); - } - bool element_identifier_anonymous_array_TheOtherObjectInArray_5_ec {false}; - TypeIdentifier* element_identifier_anonymous_array_TheOtherObjectInArray_5 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_structs, element_identifier_anonymous_array_TheOtherObjectInArray_5_ec))}; - if (!element_identifier_anonymous_array_TheOtherObjectInArray_5_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_COMPLETE; - if (TK_NONE == type_ids_sub_structs.type_identifier2()._d()) - { - equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_array_TheOtherObjectInArray_5 = 0; - PlainCollectionHeader header_anonymous_array_TheOtherObjectInArray_5 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_TheOtherObjectInArray_5, element_flags_anonymous_array_TheOtherObjectInArray_5); - { - SBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(5)); - - PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_TheOtherObjectInArray_5, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_TheOtherObjectInArray_5)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_TheOtherObjectInArray_5", type_ids_sub_structs)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_TheOtherObjectInArray_5 already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_sub_structs = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_sub_structs = 0x00000001; - bool common_sub_structs_ec {false}; - CommonStructMember common_sub_structs {TypeObjectUtils::build_common_struct_member(member_id_sub_structs, member_flags_sub_structs, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_structs, common_sub_structs_ec))}; - if (!common_sub_structs_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub_structs member TypeIdentifier inconsistent."); - return; - } - MemberName name_sub_structs = "sub_structs"; - eprosima::fastcdr::optional member_ann_builtin_sub_structs; - ann_custom_basic_array_struct.reset(); - CompleteMemberDetail detail_sub_structs = TypeObjectUtils::build_complete_member_detail(name_sub_structs, member_ann_builtin_sub_structs, ann_custom_basic_array_struct); - CompleteStructMember member_sub_structs = TypeObjectUtils::build_complete_struct_member(common_sub_structs, detail_sub_structs); - TypeObjectUtils::add_complete_struct_member(member_seq_basic_array_struct, member_sub_structs); - } - CompleteStructType struct_type_basic_array_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_array_struct, header_basic_array_struct, member_seq_basic_array_struct); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_array_struct, type_name_basic_array_struct.to_string(), type_ids_basic_array_struct)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "basic_array_struct already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp deleted file mode 100644 index afa3f5f9..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp +++ /dev/null @@ -1,68 +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 basic_array_structTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_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 - -/** - * @brief Register TheOtherObjectInArray related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_TheOtherObjectInArray_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register basic_array_struct related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_basic_array_struct_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp deleted file mode 100644 index 9ba4805a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp +++ /dev/null @@ -1,311 +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 basic_struct.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_HPP -#define FAST_DDS_GENERATED__BASIC_STRUCT_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(BASIC_STRUCT_SOURCE) -#define BASIC_STRUCT_DllAPI __declspec( dllexport ) -#else -#define BASIC_STRUCT_DllAPI __declspec( dllimport ) -#endif // BASIC_STRUCT_SOURCE -#else -#define BASIC_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define BASIC_STRUCT_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure TheOtherObject defined by the user in the IDL file. - * @ingroup basic_struct - */ -class TheOtherObject -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport TheOtherObject() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~TheOtherObject() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject( - const TheOtherObject& x) - { - m_some_num = x.m_some_num; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject( - TheOtherObject&& x) noexcept - { - m_some_num = x.m_some_num; - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject& operator =( - const TheOtherObject& x) - { - - m_some_num = x.m_some_num; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object TheOtherObject that will be copied. - */ - eProsima_user_DllExport TheOtherObject& operator =( - TheOtherObject&& x) noexcept - { - - m_some_num = x.m_some_num; - return *this; - } - - /*! - * @brief Comparison operator. - * @param x TheOtherObject object to compare. - */ - eProsima_user_DllExport bool operator ==( - const TheOtherObject& x) const - { - return (m_some_num == x.m_some_num); - } - - /*! - * @brief Comparison operator. - * @param x TheOtherObject object to compare. - */ - eProsima_user_DllExport bool operator !=( - const TheOtherObject& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member some_num - * @param _some_num New value for member some_num - */ - eProsima_user_DllExport void some_num( - int32_t _some_num) - { - m_some_num = _some_num; - } - - /*! - * @brief This function returns the value of member some_num - * @return Value of member some_num - */ - eProsima_user_DllExport int32_t some_num() const - { - return m_some_num; - } - - /*! - * @brief This function returns a reference to member some_num - * @return Reference to member some_num - */ - eProsima_user_DllExport int32_t& some_num() - { - return m_some_num; - } - - - -private: - - int32_t m_some_num{0}; - -}; -/*! - * @brief This class represents the structure basic_struct defined by the user in the IDL file. - * @ingroup basic_struct - */ -class basic_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport basic_struct() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~basic_struct() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct( - const basic_struct& x) - { - m_sub_struct = x.m_sub_struct; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct( - basic_struct&& x) noexcept - { - m_sub_struct = std::move(x.m_sub_struct); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct& operator =( - const basic_struct& x) - { - - m_sub_struct = x.m_sub_struct; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object basic_struct that will be copied. - */ - eProsima_user_DllExport basic_struct& operator =( - basic_struct&& x) noexcept - { - - m_sub_struct = std::move(x.m_sub_struct); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x basic_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const basic_struct& x) const - { - return (m_sub_struct == x.m_sub_struct); - } - - /*! - * @brief Comparison operator. - * @param x basic_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const basic_struct& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member sub_struct - * @param _sub_struct New value to be copied in member sub_struct - */ - eProsima_user_DllExport void sub_struct( - const TheOtherObject& _sub_struct) - { - m_sub_struct = _sub_struct; - } - - /*! - * @brief This function moves the value in member sub_struct - * @param _sub_struct New value to be moved in member sub_struct - */ - eProsima_user_DllExport void sub_struct( - TheOtherObject&& _sub_struct) - { - m_sub_struct = std::move(_sub_struct); - } - - /*! - * @brief This function returns a constant reference to member sub_struct - * @return Constant reference to member sub_struct - */ - eProsima_user_DllExport const TheOtherObject& sub_struct() const - { - return m_sub_struct; - } - - /*! - * @brief This function returns a reference to member sub_struct - * @return Reference to member sub_struct - */ - eProsima_user_DllExport TheOtherObject& sub_struct() - { - return m_sub_struct; - } - - - -private: - - TheOtherObject m_sub_struct; - -}; - -#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp deleted file mode 100644 index ac32e369..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp +++ /dev/null @@ -1,53 +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 basic_structCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP -#define FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP - -#include "basic_struct.hpp" - -constexpr uint32_t basic_struct_max_cdr_typesize {12UL}; -constexpr uint32_t basic_struct_max_key_cdr_typesize {0UL}; - -constexpr uint32_t TheOtherObject_max_cdr_typesize {8UL}; -constexpr uint32_t TheOtherObject_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const TheOtherObject& data); - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const basic_struct& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp deleted file mode 100644 index baa8d4ad..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp +++ /dev/null @@ -1,194 +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 basic_structCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP -#define FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP - -#include "basic_structCdrAux.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 TheOtherObject& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.some_num(), 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 TheOtherObject& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.some_num() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - TheOtherObject& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.some_num(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const TheOtherObject& data) -{ - static_cast(scdr); - static_cast(data); -} - - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const basic_struct& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.sub_struct(), 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 basic_struct& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.sub_struct() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - basic_struct& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.sub_struct(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const basic_struct& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx deleted file mode 100644 index e42464da..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx +++ /dev/null @@ -1,422 +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 basic_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "basic_structPubSubTypes.hpp" - -#include -#include - -#include "basic_structCdrAux.hpp" -#include "basic_structTypeObjectSupport.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; - -TheOtherObjectPubSubType::TheOtherObjectPubSubType() -{ - setName("TheOtherObject"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(TheOtherObject::getMaxCdrSerializedSize()); -#else - TheOtherObject_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = TheOtherObject_max_key_cdr_typesize > 16 ? TheOtherObject_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -TheOtherObjectPubSubType::~TheOtherObjectPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool TheOtherObjectPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const TheOtherObject* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool TheOtherObjectPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - TheOtherObject* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function TheOtherObjectPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* TheOtherObjectPubSubType::createData() -{ - return reinterpret_cast(new TheOtherObject()); -} - -void TheOtherObjectPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool TheOtherObjectPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const TheOtherObject* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - TheOtherObject_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || TheOtherObject_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void TheOtherObjectPubSubType::register_type_object_representation() -{ - register_TheOtherObject_type_identifier(type_identifiers_); -} - -basic_structPubSubType::basic_structPubSubType() -{ - setName("basic_struct"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(basic_struct::getMaxCdrSerializedSize()); -#else - basic_struct_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = basic_struct_max_key_cdr_typesize > 16 ? basic_struct_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -basic_structPubSubType::~basic_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool basic_structPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const basic_struct* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool basic_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - basic_struct* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function basic_structPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* basic_structPubSubType::createData() -{ - return reinterpret_cast(new basic_struct()); -} - -void basic_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool basic_structPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const basic_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - basic_struct_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || basic_struct_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void basic_structPubSubType::register_type_object_representation() -{ - register_basic_struct_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "basic_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp deleted file mode 100644 index 29824879..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp +++ /dev/null @@ -1,224 +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 basic_structPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "basic_struct.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated basic_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type TheOtherObject defined by the user in the IDL file. - * @ingroup basic_struct - */ -class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef TheOtherObject type; - - eProsima_user_DllExport TheOtherObjectPubSubType(); - - eProsima_user_DllExport ~TheOtherObjectPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -/*! - * @brief This class represents the TopicDataType of the type basic_struct defined by the user in the IDL file. - * @ingroup basic_struct - */ -class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef basic_struct type; - - eProsima_user_DllExport basic_structPubSubType(); - - eProsima_user_DllExport ~basic_structPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx deleted file mode 100644 index b57ea0db..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx +++ /dev/null @@ -1,157 +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 basic_structTypeObjectSupport.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. - */ - -#include "basic_structTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "basic_struct.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_TheOtherObject_type_identifier( - TypeIdentifierPair& type_ids_TheOtherObject) -{ - - ReturnCode_t return_code_TheOtherObject {eprosima::fastdds::dds::RETCODE_OK}; - return_code_TheOtherObject = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObject", type_ids_TheOtherObject); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObject) - { - StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_TheOtherObject = "TheOtherObject"; - eprosima::fastcdr::optional type_ann_builtin_TheOtherObject; - eprosima::fastcdr::optional ann_custom_TheOtherObject; - CompleteTypeDetail detail_TheOtherObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObject, ann_custom_TheOtherObject, type_name_TheOtherObject.to_string()); - CompleteStructHeader header_TheOtherObject; - header_TheOtherObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObject); - CompleteStructMemberSeq member_seq_TheOtherObject; - { - TypeIdentifierPair type_ids_some_num; - ReturnCode_t return_code_some_num {eprosima::fastdds::dds::RETCODE_OK}; - return_code_some_num = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_some_num); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_some_num) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_some_num = 0x00000000; - bool common_some_num_ec {false}; - CommonStructMember common_some_num {TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_some_num, common_some_num_ec))}; - if (!common_some_num_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure some_num member TypeIdentifier inconsistent."); - return; - } - MemberName name_some_num = "some_num"; - eprosima::fastcdr::optional member_ann_builtin_some_num; - ann_custom_TheOtherObject.reset(); - CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObject); - CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); - TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObject, member_some_num); - } - CompleteStructType struct_type_TheOtherObject = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObject, header_TheOtherObject, member_seq_TheOtherObject); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObject, type_name_TheOtherObject.to_string(), type_ids_TheOtherObject)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "TheOtherObject already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_basic_struct_type_identifier( - TypeIdentifierPair& type_ids_basic_struct) -{ - - ReturnCode_t return_code_basic_struct {eprosima::fastdds::dds::RETCODE_OK}; - return_code_basic_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "basic_struct", type_ids_basic_struct); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_struct) - { - StructTypeFlag struct_flags_basic_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_basic_struct = "basic_struct"; - eprosima::fastcdr::optional type_ann_builtin_basic_struct; - eprosima::fastcdr::optional ann_custom_basic_struct; - CompleteTypeDetail detail_basic_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_basic_struct, ann_custom_basic_struct, type_name_basic_struct.to_string()); - CompleteStructHeader header_basic_struct; - header_basic_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_struct); - CompleteStructMemberSeq member_seq_basic_struct; - { - TypeIdentifierPair type_ids_sub_struct; - ReturnCode_t return_code_sub_struct {eprosima::fastdds::dds::RETCODE_OK}; - return_code_sub_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "TheOtherObject", type_ids_sub_struct); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_struct) - { - ::register_TheOtherObject_type_identifier(type_ids_sub_struct); - } - StructMemberFlag member_flags_sub_struct = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_sub_struct = 0x00000000; - bool common_sub_struct_ec {false}; - CommonStructMember common_sub_struct {TypeObjectUtils::build_common_struct_member(member_id_sub_struct, member_flags_sub_struct, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_struct, common_sub_struct_ec))}; - if (!common_sub_struct_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub_struct member TypeIdentifier inconsistent."); - return; - } - MemberName name_sub_struct = "sub_struct"; - eprosima::fastcdr::optional member_ann_builtin_sub_struct; - ann_custom_basic_struct.reset(); - CompleteMemberDetail detail_sub_struct = TypeObjectUtils::build_complete_member_detail(name_sub_struct, member_ann_builtin_sub_struct, ann_custom_basic_struct); - CompleteStructMember member_sub_struct = TypeObjectUtils::build_complete_struct_member(common_sub_struct, detail_sub_struct); - TypeObjectUtils::add_complete_struct_member(member_seq_basic_struct, member_sub_struct); - } - CompleteStructType struct_type_basic_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_struct, header_basic_struct, member_seq_basic_struct); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_struct, type_name_basic_struct.to_string(), type_ids_basic_struct)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "basic_struct already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp deleted file mode 100644 index d2cc9a74..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp +++ /dev/null @@ -1,68 +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 basic_structTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__BASIC_STRUCT_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 - -/** - * @brief Register TheOtherObject related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_TheOtherObject_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register basic_struct related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_basic_struct_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp deleted file mode 100644 index 98e9d533..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp +++ /dev/null @@ -1,190 +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 char_sequence.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_HPP -#define FAST_DDS_GENERATED__CHAR_SEQUENCE_HPP - -#include -#include -#include - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(CHAR_SEQUENCE_SOURCE) -#define CHAR_SEQUENCE_DllAPI __declspec( dllexport ) -#else -#define CHAR_SEQUENCE_DllAPI __declspec( dllimport ) -#endif // CHAR_SEQUENCE_SOURCE -#else -#define CHAR_SEQUENCE_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define CHAR_SEQUENCE_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure char_sequence defined by the user in the IDL file. - * @ingroup char_sequence - */ -class char_sequence -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport char_sequence() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~char_sequence() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence( - const char_sequence& x) - { - m_chars = x.m_chars; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence( - char_sequence&& x) noexcept - { - m_chars = std::move(x.m_chars); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence& operator =( - const char_sequence& x) - { - - m_chars = x.m_chars; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object char_sequence that will be copied. - */ - eProsima_user_DllExport char_sequence& operator =( - char_sequence&& x) noexcept - { - - m_chars = std::move(x.m_chars); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x char_sequence object to compare. - */ - eProsima_user_DllExport bool operator ==( - const char_sequence& x) const - { - return (m_chars == x.m_chars); - } - - /*! - * @brief Comparison operator. - * @param x char_sequence object to compare. - */ - eProsima_user_DllExport bool operator !=( - const char_sequence& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member chars - * @param _chars New value to be copied in member chars - */ - eProsima_user_DllExport void chars( - const std::vector& _chars) - { - m_chars = _chars; - } - - /*! - * @brief This function moves the value in member chars - * @param _chars New value to be moved in member chars - */ - eProsima_user_DllExport void chars( - std::vector&& _chars) - { - m_chars = std::move(_chars); - } - - /*! - * @brief This function returns a constant reference to member chars - * @return Constant reference to member chars - */ - eProsima_user_DllExport const std::vector& chars() const - { - return m_chars; - } - - /*! - * @brief This function returns a reference to member chars - * @return Reference to member chars - */ - eProsima_user_DllExport std::vector& chars() - { - return m_chars; - } - - - -private: - - std::vector m_chars; - -}; - -#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp deleted file mode 100644 index a1d9b9ad..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.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 char_sequenceCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP -#define FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP - -#include "char_sequence.hpp" - -constexpr uint32_t char_sequence_max_cdr_typesize {8UL}; -constexpr uint32_t char_sequence_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const char_sequence& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp deleted file mode 100644 index ef63929e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp +++ /dev/null @@ -1,118 +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 char_sequenceCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP -#define FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP - -#include "char_sequenceCdrAux.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 char_sequence& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.chars(), 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 char_sequence& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.chars() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - char_sequence& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.chars(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const char_sequence& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx deleted file mode 100644 index c066f9e0..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx +++ /dev/null @@ -1,229 +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 char_sequencePubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "char_sequencePubSubTypes.hpp" - -#include -#include - -#include "char_sequenceCdrAux.hpp" -#include "char_sequenceTypeObjectSupport.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; - -char_sequencePubSubType::char_sequencePubSubType() -{ - setName("char_sequence"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(char_sequence::getMaxCdrSerializedSize()); -#else - char_sequence_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = char_sequence_max_key_cdr_typesize > 16 ? char_sequence_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -char_sequencePubSubType::~char_sequencePubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool char_sequencePubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const char_sequence* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool char_sequencePubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - char_sequence* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function char_sequencePubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* char_sequencePubSubType::createData() -{ - return reinterpret_cast(new char_sequence()); -} - -void char_sequencePubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool char_sequencePubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const char_sequence* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - char_sequence_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || char_sequence_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void char_sequencePubSubType::register_type_object_representation() -{ - register_char_sequence_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "char_sequenceCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp deleted file mode 100644 index 90af7267..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp +++ /dev/null @@ -1,133 +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 char_sequencePubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "char_sequence.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated char_sequence is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type char_sequence defined by the user in the IDL file. - * @ingroup char_sequence - */ -class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef char_sequence type; - - eProsima_user_DllExport char_sequencePubSubType(); - - eProsima_user_DllExport ~char_sequencePubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx deleted file mode 100644 index 24ddf288..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx +++ /dev/null @@ -1,132 +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 char_sequenceTypeObjectSupport.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. - */ - -#include "char_sequenceTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "char_sequence.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_char_sequence_type_identifier( - TypeIdentifierPair& type_ids_char_sequence) -{ - - ReturnCode_t return_code_char_sequence {eprosima::fastdds::dds::RETCODE_OK}; - return_code_char_sequence = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "char_sequence", type_ids_char_sequence); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_char_sequence) - { - StructTypeFlag struct_flags_char_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_char_sequence = "char_sequence"; - eprosima::fastcdr::optional type_ann_builtin_char_sequence; - eprosima::fastcdr::optional ann_custom_char_sequence; - CompleteTypeDetail detail_char_sequence = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_char_sequence, ann_custom_char_sequence, type_name_char_sequence.to_string()); - CompleteStructHeader header_char_sequence; - header_char_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_char_sequence); - CompleteStructMemberSeq member_seq_char_sequence; - { - TypeIdentifierPair type_ids_chars; - ReturnCode_t return_code_chars {eprosima::fastdds::dds::RETCODE_OK}; - return_code_chars = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_char_unbounded", type_ids_chars); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_chars) - { - return_code_chars = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_char", type_ids_chars); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_chars) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - bool element_identifier_anonymous_sequence_char_unbounded_ec {false}; - TypeIdentifier* element_identifier_anonymous_sequence_char_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_chars, element_identifier_anonymous_sequence_char_unbounded_ec))}; - if (!element_identifier_anonymous_sequence_char_unbounded_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_char_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_chars.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_char_unbounded = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_char_unbounded = 0; - PlainCollectionHeader header_anonymous_sequence_char_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_char_unbounded, element_flags_anonymous_sequence_char_unbounded); - { - SBound bound = 0; - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_char_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_char_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_char_unbounded", type_ids_chars)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_char_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_chars = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_chars = 0x00000000; - bool common_chars_ec {false}; - CommonStructMember common_chars {TypeObjectUtils::build_common_struct_member(member_id_chars, member_flags_chars, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_chars, common_chars_ec))}; - if (!common_chars_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure chars member TypeIdentifier inconsistent."); - return; - } - MemberName name_chars = "chars"; - eprosima::fastcdr::optional member_ann_builtin_chars; - ann_custom_char_sequence.reset(); - CompleteMemberDetail detail_chars = TypeObjectUtils::build_complete_member_detail(name_chars, member_ann_builtin_chars, ann_custom_char_sequence); - CompleteStructMember member_chars = TypeObjectUtils::build_complete_struct_member(common_chars, detail_chars); - TypeObjectUtils::add_complete_struct_member(member_seq_char_sequence, member_chars); - } - CompleteStructType struct_type_char_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_char_sequence, header_char_sequence, member_seq_char_sequence); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_char_sequence, type_name_char_sequence.to_string(), type_ids_char_sequence)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "char_sequence already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp deleted file mode 100644 index 45d4779e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp +++ /dev/null @@ -1,56 +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 char_sequenceTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__CHAR_SEQUENCE_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 - -/** - * @brief Register char_sequence related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_char_sequence_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp deleted file mode 100644 index 1f7a722b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp +++ /dev/null @@ -1,760 +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 complex_nested_arrays.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_HPP -#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_HPP - -#include -#include -#include -#include -#include - -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(COMPLEX_NESTED_ARRAYS_SOURCE) -#define COMPLEX_NESTED_ARRAYS_DllAPI __declspec( dllexport ) -#else -#define COMPLEX_NESTED_ARRAYS_DllAPI __declspec( dllimport ) -#endif // COMPLEX_NESTED_ARRAYS_SOURCE -#else -#define COMPLEX_NESTED_ARRAYS_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define COMPLEX_NESTED_ARRAYS_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure ThirdLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class ThirdLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport ThirdLevelElement() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~ThirdLevelElement() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement( - const ThirdLevelElement& x) - { - m_x = x.m_x; - - m_y = x.m_y; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement( - ThirdLevelElement&& x) noexcept - { - m_x = x.m_x; - m_y = x.m_y; - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement& operator =( - const ThirdLevelElement& x) - { - - m_x = x.m_x; - - m_y = x.m_y; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object ThirdLevelElement that will be copied. - */ - eProsima_user_DllExport ThirdLevelElement& operator =( - ThirdLevelElement&& x) noexcept - { - - m_x = x.m_x; - m_y = x.m_y; - return *this; - } - - /*! - * @brief Comparison operator. - * @param x ThirdLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const ThirdLevelElement& x) const - { - return (m_x == x.m_x && - m_y == x.m_y); - } - - /*! - * @brief Comparison operator. - * @param x ThirdLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const ThirdLevelElement& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member x - * @param _x New value for member x - */ - eProsima_user_DllExport void x( - double _x) - { - m_x = _x; - } - - /*! - * @brief This function returns the value of member x - * @return Value of member x - */ - eProsima_user_DllExport double x() const - { - return m_x; - } - - /*! - * @brief This function returns a reference to member x - * @return Reference to member x - */ - eProsima_user_DllExport double& x() - { - return m_x; - } - - - /*! - * @brief This function sets a value in member y - * @param _y New value for member y - */ - eProsima_user_DllExport void y( - double _y) - { - m_y = _y; - } - - /*! - * @brief This function returns the value of member y - * @return Value of member y - */ - eProsima_user_DllExport double y() const - { - return m_y; - } - - /*! - * @brief This function returns a reference to member y - * @return Reference to member y - */ - eProsima_user_DllExport double& y() - { - return m_y; - } - - - -private: - - double m_x{0.0}; - double m_y{0.0}; - -}; -/*! - * @brief This class represents the structure SecondLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class SecondLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SecondLevelElement() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SecondLevelElement() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement( - const SecondLevelElement& x) - { - m_an_element_alone = x.m_an_element_alone; - - m_a_limited_other_value = x.m_a_limited_other_value; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement( - SecondLevelElement&& x) noexcept - { - m_an_element_alone = std::move(x.m_an_element_alone); - m_a_limited_other_value = std::move(x.m_a_limited_other_value); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement& operator =( - const SecondLevelElement& x) - { - - m_an_element_alone = x.m_an_element_alone; - - m_a_limited_other_value = x.m_a_limited_other_value; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object SecondLevelElement that will be copied. - */ - eProsima_user_DllExport SecondLevelElement& operator =( - SecondLevelElement&& x) noexcept - { - - m_an_element_alone = std::move(x.m_an_element_alone); - m_a_limited_other_value = std::move(x.m_a_limited_other_value); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x SecondLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SecondLevelElement& x) const - { - return (m_an_element_alone == x.m_an_element_alone && - m_a_limited_other_value == x.m_a_limited_other_value); - } - - /*! - * @brief Comparison operator. - * @param x SecondLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SecondLevelElement& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone) - { - m_an_element_alone = _an_element_alone; - } - - /*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone) - { - m_an_element_alone = std::move(_an_element_alone); - } - - /*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const - { - return m_an_element_alone; - } - - /*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone() - { - return m_an_element_alone; - } - - - /*! - * @brief This function copies the value in member a_limited_other_value - * @param _a_limited_other_value New value to be copied in member a_limited_other_value - */ - eProsima_user_DllExport void a_limited_other_value( - const std::vector& _a_limited_other_value) - { - m_a_limited_other_value = _a_limited_other_value; - } - - /*! - * @brief This function moves the value in member a_limited_other_value - * @param _a_limited_other_value New value to be moved in member a_limited_other_value - */ - eProsima_user_DllExport void a_limited_other_value( - std::vector&& _a_limited_other_value) - { - m_a_limited_other_value = std::move(_a_limited_other_value); - } - - /*! - * @brief This function returns a constant reference to member a_limited_other_value - * @return Constant reference to member a_limited_other_value - */ - eProsima_user_DllExport const std::vector& a_limited_other_value() const - { - return m_a_limited_other_value; - } - - /*! - * @brief This function returns a reference to member a_limited_other_value - * @return Reference to member a_limited_other_value - */ - eProsima_user_DllExport std::vector& a_limited_other_value() - { - return m_a_limited_other_value; - } - - - -private: - - ThirdLevelElement m_an_element_alone; - std::vector m_a_limited_other_value; - -}; -/*! - * @brief This class represents the structure FirstLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class FirstLevelElement -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport FirstLevelElement() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~FirstLevelElement() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement( - const FirstLevelElement& x) - { - m_useless_name = x.m_useless_name; - - m_sub = x.m_sub; - - m_an_element_alone = x.m_an_element_alone; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement( - FirstLevelElement&& x) noexcept - { - m_useless_name = std::move(x.m_useless_name); - m_sub = std::move(x.m_sub); - m_an_element_alone = std::move(x.m_an_element_alone); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement& operator =( - const FirstLevelElement& x) - { - - m_useless_name = x.m_useless_name; - - m_sub = x.m_sub; - - m_an_element_alone = x.m_an_element_alone; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object FirstLevelElement that will be copied. - */ - eProsima_user_DllExport FirstLevelElement& operator =( - FirstLevelElement&& x) noexcept - { - - m_useless_name = std::move(x.m_useless_name); - m_sub = std::move(x.m_sub); - m_an_element_alone = std::move(x.m_an_element_alone); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x FirstLevelElement object to compare. - */ - eProsima_user_DllExport bool operator ==( - const FirstLevelElement& x) const - { - return (m_useless_name == x.m_useless_name && - m_sub == x.m_sub && - m_an_element_alone == x.m_an_element_alone); - } - - /*! - * @brief Comparison operator. - * @param x FirstLevelElement object to compare. - */ - eProsima_user_DllExport bool operator !=( - const FirstLevelElement& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member useless_name - * @param _useless_name New value to be copied in member useless_name - */ - eProsima_user_DllExport void useless_name( - const std::string& _useless_name) - { - m_useless_name = _useless_name; - } - - /*! - * @brief This function moves the value in member useless_name - * @param _useless_name New value to be moved in member useless_name - */ - eProsima_user_DllExport void useless_name( - std::string&& _useless_name) - { - m_useless_name = std::move(_useless_name); - } - - /*! - * @brief This function returns a constant reference to member useless_name - * @return Constant reference to member useless_name - */ - eProsima_user_DllExport const std::string& useless_name() const - { - return m_useless_name; - } - - /*! - * @brief This function returns a reference to member useless_name - * @return Reference to member useless_name - */ - eProsima_user_DllExport std::string& useless_name() - { - return m_useless_name; - } - - - /*! - * @brief This function copies the value in member sub - * @param _sub New value to be copied in member sub - */ - eProsima_user_DllExport void sub( - const std::vector& _sub) - { - m_sub = _sub; - } - - /*! - * @brief This function moves the value in member sub - * @param _sub New value to be moved in member sub - */ - eProsima_user_DllExport void sub( - std::vector&& _sub) - { - m_sub = std::move(_sub); - } - - /*! - * @brief This function returns a constant reference to member sub - * @return Constant reference to member sub - */ - eProsima_user_DllExport const std::vector& sub() const - { - return m_sub; - } - - /*! - * @brief This function returns a reference to member sub - * @return Reference to member sub - */ - eProsima_user_DllExport std::vector& sub() - { - return m_sub; - } - - - /*! - * @brief This function copies the value in member an_element_alone - * @param _an_element_alone New value to be copied in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - const ThirdLevelElement& _an_element_alone) - { - m_an_element_alone = _an_element_alone; - } - - /*! - * @brief This function moves the value in member an_element_alone - * @param _an_element_alone New value to be moved in member an_element_alone - */ - eProsima_user_DllExport void an_element_alone( - ThirdLevelElement&& _an_element_alone) - { - m_an_element_alone = std::move(_an_element_alone); - } - - /*! - * @brief This function returns a constant reference to member an_element_alone - * @return Constant reference to member an_element_alone - */ - eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const - { - return m_an_element_alone; - } - - /*! - * @brief This function returns a reference to member an_element_alone - * @return Reference to member an_element_alone - */ - eProsima_user_DllExport ThirdLevelElement& an_element_alone() - { - return m_an_element_alone; - } - - - -private: - - std::string m_useless_name; - std::vector m_sub; - ThirdLevelElement m_an_element_alone; - -}; -/*! - * @brief This class represents the structure complex_nested_arrays defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class complex_nested_arrays -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport complex_nested_arrays() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~complex_nested_arrays() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays( - const complex_nested_arrays& x) - { - m_array_of_elements = x.m_array_of_elements; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays( - complex_nested_arrays&& x) noexcept - { - m_array_of_elements = std::move(x.m_array_of_elements); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays& operator =( - const complex_nested_arrays& x) - { - - m_array_of_elements = x.m_array_of_elements; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object complex_nested_arrays that will be copied. - */ - eProsima_user_DllExport complex_nested_arrays& operator =( - complex_nested_arrays&& x) noexcept - { - - m_array_of_elements = std::move(x.m_array_of_elements); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x complex_nested_arrays object to compare. - */ - eProsima_user_DllExport bool operator ==( - const complex_nested_arrays& x) const - { - return (m_array_of_elements == x.m_array_of_elements); - } - - /*! - * @brief Comparison operator. - * @param x complex_nested_arrays object to compare. - */ - eProsima_user_DllExport bool operator !=( - const complex_nested_arrays& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member array_of_elements - * @param _array_of_elements New value to be copied in member array_of_elements - */ - eProsima_user_DllExport void array_of_elements( - const std::array& _array_of_elements) - { - m_array_of_elements = _array_of_elements; - } - - /*! - * @brief This function moves the value in member array_of_elements - * @param _array_of_elements New value to be moved in member array_of_elements - */ - eProsima_user_DllExport void array_of_elements( - std::array&& _array_of_elements) - { - m_array_of_elements = std::move(_array_of_elements); - } - - /*! - * @brief This function returns a constant reference to member array_of_elements - * @return Constant reference to member array_of_elements - */ - eProsima_user_DllExport const std::array& array_of_elements() const - { - return m_array_of_elements; - } - - /*! - * @brief This function returns a reference to member array_of_elements - * @return Reference to member array_of_elements - */ - eProsima_user_DllExport std::array& array_of_elements() - { - return m_array_of_elements; - } - - - -private: - - std::array m_array_of_elements; - -}; - -#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp deleted file mode 100644 index d5085176..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp +++ /dev/null @@ -1,67 +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 complex_nested_arraysCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP -#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP - -#include "complex_nested_arrays.hpp" - -constexpr uint32_t FirstLevelElement_max_cdr_typesize {296UL}; -constexpr uint32_t FirstLevelElement_max_key_cdr_typesize {0UL}; - -constexpr uint32_t ThirdLevelElement_max_cdr_typesize {24UL}; -constexpr uint32_t ThirdLevelElement_max_key_cdr_typesize {0UL}; - -constexpr uint32_t SecondLevelElement_max_cdr_typesize {56UL}; -constexpr uint32_t SecondLevelElement_max_key_cdr_typesize {0UL}; - -constexpr uint32_t complex_nested_arrays_max_cdr_typesize {896UL}; -constexpr uint32_t complex_nested_arrays_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ThirdLevelElement& data); - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const SecondLevelElement& data); - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const FirstLevelElement& data); - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const complex_nested_arrays& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp deleted file mode 100644 index 6744f03e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp +++ /dev/null @@ -1,378 +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 complex_nested_arraysCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP -#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP - -#include "complex_nested_arraysCdrAux.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 ThirdLevelElement& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.x(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.y(), 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 ThirdLevelElement& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.x() - << eprosima::fastcdr::MemberId(1) << data.y() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ThirdLevelElement& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.x(); - break; - - case 1: - dcdr >> data.y(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ThirdLevelElement& data) -{ - static_cast(scdr); - static_cast(data); -} - - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const SecondLevelElement& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.an_element_alone(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.a_limited_other_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 SecondLevelElement& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.an_element_alone() - << eprosima::fastcdr::MemberId(1) << data.a_limited_other_value() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - SecondLevelElement& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.an_element_alone(); - break; - - case 1: - dcdr >> data.a_limited_other_value(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const SecondLevelElement& data) -{ - static_cast(scdr); - static_cast(data); -} - - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const FirstLevelElement& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.useless_name(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.sub(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.an_element_alone(), 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 FirstLevelElement& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.useless_name() - << eprosima::fastcdr::MemberId(1) << data.sub() - << eprosima::fastcdr::MemberId(2) << data.an_element_alone() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - FirstLevelElement& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.useless_name(); - break; - - case 1: - dcdr >> data.sub(); - break; - - case 2: - dcdr >> data.an_element_alone(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const FirstLevelElement& data) -{ - static_cast(scdr); - static_cast(data); -} - - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const complex_nested_arrays& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.array_of_elements(), 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 complex_nested_arrays& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.array_of_elements() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - complex_nested_arrays& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.array_of_elements(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const complex_nested_arrays& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx deleted file mode 100644 index 25169cfa..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx +++ /dev/null @@ -1,808 +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 complex_nested_arraysPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "complex_nested_arraysPubSubTypes.hpp" - -#include -#include - -#include "complex_nested_arraysCdrAux.hpp" -#include "complex_nested_arraysTypeObjectSupport.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; - -ThirdLevelElementPubSubType::ThirdLevelElementPubSubType() -{ - setName("ThirdLevelElement"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(ThirdLevelElement::getMaxCdrSerializedSize()); -#else - ThirdLevelElement_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = ThirdLevelElement_max_key_cdr_typesize > 16 ? ThirdLevelElement_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -ThirdLevelElementPubSubType::~ThirdLevelElementPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool ThirdLevelElementPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const ThirdLevelElement* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool ThirdLevelElementPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - ThirdLevelElement* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function ThirdLevelElementPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* ThirdLevelElementPubSubType::createData() -{ - return reinterpret_cast(new ThirdLevelElement()); -} - -void ThirdLevelElementPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool ThirdLevelElementPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const ThirdLevelElement* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - ThirdLevelElement_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || ThirdLevelElement_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void ThirdLevelElementPubSubType::register_type_object_representation() -{ - register_ThirdLevelElement_type_identifier(type_identifiers_); -} - -SecondLevelElementPubSubType::SecondLevelElementPubSubType() -{ - setName("SecondLevelElement"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(SecondLevelElement::getMaxCdrSerializedSize()); -#else - SecondLevelElement_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = SecondLevelElement_max_key_cdr_typesize > 16 ? SecondLevelElement_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -SecondLevelElementPubSubType::~SecondLevelElementPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool SecondLevelElementPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const SecondLevelElement* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool SecondLevelElementPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - SecondLevelElement* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function SecondLevelElementPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* SecondLevelElementPubSubType::createData() -{ - return reinterpret_cast(new SecondLevelElement()); -} - -void SecondLevelElementPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool SecondLevelElementPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const SecondLevelElement* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - SecondLevelElement_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || SecondLevelElement_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void SecondLevelElementPubSubType::register_type_object_representation() -{ - register_SecondLevelElement_type_identifier(type_identifiers_); -} - -FirstLevelElementPubSubType::FirstLevelElementPubSubType() -{ - setName("FirstLevelElement"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(FirstLevelElement::getMaxCdrSerializedSize()); -#else - FirstLevelElement_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = FirstLevelElement_max_key_cdr_typesize > 16 ? FirstLevelElement_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -FirstLevelElementPubSubType::~FirstLevelElementPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool FirstLevelElementPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const FirstLevelElement* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool FirstLevelElementPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - FirstLevelElement* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function FirstLevelElementPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* FirstLevelElementPubSubType::createData() -{ - return reinterpret_cast(new FirstLevelElement()); -} - -void FirstLevelElementPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool FirstLevelElementPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const FirstLevelElement* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - FirstLevelElement_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || FirstLevelElement_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void FirstLevelElementPubSubType::register_type_object_representation() -{ - register_FirstLevelElement_type_identifier(type_identifiers_); -} - -complex_nested_arraysPubSubType::complex_nested_arraysPubSubType() -{ - setName("complex_nested_arrays"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(complex_nested_arrays::getMaxCdrSerializedSize()); -#else - complex_nested_arrays_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = complex_nested_arrays_max_key_cdr_typesize > 16 ? complex_nested_arrays_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -complex_nested_arraysPubSubType::~complex_nested_arraysPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool complex_nested_arraysPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const complex_nested_arrays* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool complex_nested_arraysPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - complex_nested_arrays* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function complex_nested_arraysPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* complex_nested_arraysPubSubType::createData() -{ - return reinterpret_cast(new complex_nested_arrays()); -} - -void complex_nested_arraysPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool complex_nested_arraysPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const complex_nested_arrays* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - complex_nested_arrays_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || complex_nested_arrays_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void complex_nested_arraysPubSubType::register_type_object_representation() -{ - register_complex_nested_arrays_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "complex_nested_arraysCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp deleted file mode 100644 index 578f1555..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp +++ /dev/null @@ -1,406 +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 complex_nested_arraysPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "complex_nested_arrays.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated complex_nested_arrays is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type ThirdLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef ThirdLevelElement type; - - eProsima_user_DllExport ThirdLevelElementPubSubType(); - - eProsima_user_DllExport ~ThirdLevelElementPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -/*! - * @brief This class represents the TopicDataType of the type SecondLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef SecondLevelElement type; - - eProsima_user_DllExport SecondLevelElementPubSubType(); - - eProsima_user_DllExport ~SecondLevelElementPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -/*! - * @brief This class represents the TopicDataType of the type FirstLevelElement defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef FirstLevelElement type; - - eProsima_user_DllExport FirstLevelElementPubSubType(); - - eProsima_user_DllExport ~FirstLevelElementPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -/*! - * @brief This class represents the TopicDataType of the type complex_nested_arrays defined by the user in the IDL file. - * @ingroup complex_nested_arrays - */ -class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef complex_nested_arrays type; - - eProsima_user_DllExport complex_nested_arraysPubSubType(); - - eProsima_user_DllExport ~complex_nested_arraysPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx deleted file mode 100644 index 2e9d0cf4..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx +++ /dev/null @@ -1,493 +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 complex_nested_arraysTypeObjectSupport.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. - */ - -#include "complex_nested_arraysTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "complex_nested_arrays.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_ThirdLevelElement_type_identifier( - TypeIdentifierPair& type_ids_ThirdLevelElement) -{ - - ReturnCode_t return_code_ThirdLevelElement {eprosima::fastdds::dds::RETCODE_OK}; - return_code_ThirdLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_ThirdLevelElement) - { - StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; - eprosima::fastcdr::optional ann_custom_ThirdLevelElement; - CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); - CompleteStructHeader header_ThirdLevelElement; - header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); - CompleteStructMemberSeq member_seq_ThirdLevelElement; - { - TypeIdentifierPair type_ids_x; - ReturnCode_t return_code_x {eprosima::fastdds::dds::RETCODE_OK}; - return_code_x = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_x); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_x) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_x = 0x00000000; - bool common_x_ec {false}; - CommonStructMember common_x {TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_x, common_x_ec))}; - if (!common_x_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure x member TypeIdentifier inconsistent."); - return; - } - MemberName name_x = "x"; - eprosima::fastcdr::optional member_ann_builtin_x; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); - CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); - } - { - TypeIdentifierPair type_ids_y; - ReturnCode_t return_code_y {eprosima::fastdds::dds::RETCODE_OK}; - return_code_y = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_double", type_ids_y); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_y) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_y = 0x00000001; - bool common_y_ec {false}; - CommonStructMember common_y {TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_y, common_y_ec))}; - if (!common_y_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure y member TypeIdentifier inconsistent."); - return; - } - MemberName name_y = "y"; - eprosima::fastcdr::optional member_ann_builtin_y; - ann_custom_ThirdLevelElement.reset(); - CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); - CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); - TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); - } - CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string(), type_ids_ThirdLevelElement)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_SecondLevelElement_type_identifier( - TypeIdentifierPair& type_ids_SecondLevelElement) -{ - - ReturnCode_t return_code_SecondLevelElement {eprosima::fastdds::dds::RETCODE_OK}; - return_code_SecondLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "SecondLevelElement", type_ids_SecondLevelElement); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_SecondLevelElement) - { - StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; - eprosima::fastcdr::optional ann_custom_SecondLevelElement; - CompleteTypeDetail detail_SecondLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SecondLevelElement, ann_custom_SecondLevelElement, type_name_SecondLevelElement.to_string()); - CompleteStructHeader header_SecondLevelElement; - header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); - CompleteStructMemberSeq member_seq_SecondLevelElement; - { - TypeIdentifierPair type_ids_an_element_alone; - ReturnCode_t return_code_an_element_alone {eprosima::fastdds::dds::RETCODE_OK}; - return_code_an_element_alone = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_an_element_alone); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_an_element_alone) - { - ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); - } - StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_an_element_alone = 0x00000000; - bool common_an_element_alone_ec {false}; - CommonStructMember common_an_element_alone {TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_an_element_alone, common_an_element_alone_ec))}; - if (!common_an_element_alone_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure an_element_alone member TypeIdentifier inconsistent."); - return; - } - MemberName name_an_element_alone = "an_element_alone"; - eprosima::fastcdr::optional member_ann_builtin_an_element_alone; - ann_custom_SecondLevelElement.reset(); - CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_SecondLevelElement); - CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); - TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); - } - { - TypeIdentifierPair type_ids_a_limited_other_value; - ReturnCode_t return_code_a_limited_other_value {eprosima::fastdds::dds::RETCODE_OK}; - return_code_a_limited_other_value = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_ThirdLevelElement_1", type_ids_a_limited_other_value); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_a_limited_other_value) - { - return_code_a_limited_other_value = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_a_limited_other_value); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_a_limited_other_value) - { - ::register_ThirdLevelElement_type_identifier(type_ids_a_limited_other_value); - } - bool element_identifier_anonymous_sequence_ThirdLevelElement_1_ec {false}; - TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_a_limited_other_value, element_identifier_anonymous_sequence_ThirdLevelElement_1_ec))}; - if (!element_identifier_anonymous_sequence_ThirdLevelElement_1_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; - if (TK_NONE == type_ids_a_limited_other_value.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; - PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); - { - SBound bound = static_cast(1); - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1", type_ids_a_limited_other_value)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_a_limited_other_value = 0x00000001; - bool common_a_limited_other_value_ec {false}; - CommonStructMember common_a_limited_other_value {TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_a_limited_other_value, common_a_limited_other_value_ec))}; - if (!common_a_limited_other_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure a_limited_other_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_a_limited_other_value = "a_limited_other_value"; - eprosima::fastcdr::optional member_ann_builtin_a_limited_other_value; - ann_custom_SecondLevelElement.reset(); - CompleteMemberDetail detail_a_limited_other_value = TypeObjectUtils::build_complete_member_detail(name_a_limited_other_value, member_ann_builtin_a_limited_other_value, ann_custom_SecondLevelElement); - CompleteStructMember member_a_limited_other_value = TypeObjectUtils::build_complete_struct_member(common_a_limited_other_value, detail_a_limited_other_value); - TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_a_limited_other_value); - } - CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string(), type_ids_SecondLevelElement)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "SecondLevelElement already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_FirstLevelElement_type_identifier( - TypeIdentifierPair& type_ids_FirstLevelElement) -{ - - ReturnCode_t return_code_FirstLevelElement {eprosima::fastdds::dds::RETCODE_OK}; - return_code_FirstLevelElement = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "FirstLevelElement", type_ids_FirstLevelElement); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_FirstLevelElement) - { - StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_FirstLevelElement = "FirstLevelElement"; - eprosima::fastcdr::optional type_ann_builtin_FirstLevelElement; - eprosima::fastcdr::optional ann_custom_FirstLevelElement; - CompleteTypeDetail detail_FirstLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_FirstLevelElement, ann_custom_FirstLevelElement, type_name_FirstLevelElement.to_string()); - CompleteStructHeader header_FirstLevelElement; - header_FirstLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_FirstLevelElement); - CompleteStructMemberSeq member_seq_FirstLevelElement; - { - TypeIdentifierPair type_ids_useless_name; - ReturnCode_t return_code_useless_name {eprosima::fastdds::dds::RETCODE_OK}; - return_code_useless_name = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_useless_name); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_useless_name) - { - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded", type_ids_useless_name)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_useless_name = 0x00000000; - bool common_useless_name_ec {false}; - CommonStructMember common_useless_name {TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_useless_name, common_useless_name_ec))}; - if (!common_useless_name_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure useless_name member TypeIdentifier inconsistent."); - return; - } - MemberName name_useless_name = "useless_name"; - eprosima::fastcdr::optional member_ann_builtin_useless_name; - ann_custom_FirstLevelElement.reset(); - CompleteMemberDetail detail_useless_name = TypeObjectUtils::build_complete_member_detail(name_useless_name, member_ann_builtin_useless_name, ann_custom_FirstLevelElement); - CompleteStructMember member_useless_name = TypeObjectUtils::build_complete_struct_member(common_useless_name, detail_useless_name); - TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_useless_name); - } - { - TypeIdentifierPair type_ids_sub; - ReturnCode_t return_code_sub {eprosima::fastdds::dds::RETCODE_OK}; - return_code_sub = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_SecondLevelElement_unbounded", type_ids_sub); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub) - { - return_code_sub = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "SecondLevelElement", type_ids_sub); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub) - { - ::register_SecondLevelElement_type_identifier(type_ids_sub); - } - bool element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec {false}; - TypeIdentifier* element_identifier_anonymous_sequence_SecondLevelElement_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub, element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec))}; - if (!element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_COMPLETE; - if (TK_NONE == type_ids_sub.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_SecondLevelElement_unbounded = 0; - PlainCollectionHeader header_anonymous_sequence_SecondLevelElement_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_SecondLevelElement_unbounded, element_flags_anonymous_sequence_SecondLevelElement_unbounded); - { - SBound bound = 0; - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_SecondLevelElement_unbounded", type_ids_sub)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_sub = 0x00000001; - bool common_sub_ec {false}; - CommonStructMember common_sub {TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub, common_sub_ec))}; - if (!common_sub_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub member TypeIdentifier inconsistent."); - return; - } - MemberName name_sub = "sub"; - eprosima::fastcdr::optional member_ann_builtin_sub; - ann_custom_FirstLevelElement.reset(); - CompleteMemberDetail detail_sub = TypeObjectUtils::build_complete_member_detail(name_sub, member_ann_builtin_sub, ann_custom_FirstLevelElement); - CompleteStructMember member_sub = TypeObjectUtils::build_complete_struct_member(common_sub, detail_sub); - TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_sub); - } - { - TypeIdentifierPair type_ids_an_element_alone; - ReturnCode_t return_code_an_element_alone {eprosima::fastdds::dds::RETCODE_OK}; - return_code_an_element_alone = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ThirdLevelElement", type_ids_an_element_alone); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_an_element_alone) - { - ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); - } - StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_an_element_alone = 0x00000002; - bool common_an_element_alone_ec {false}; - CommonStructMember common_an_element_alone {TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_an_element_alone, common_an_element_alone_ec))}; - if (!common_an_element_alone_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure an_element_alone member TypeIdentifier inconsistent."); - return; - } - MemberName name_an_element_alone = "an_element_alone"; - eprosima::fastcdr::optional member_ann_builtin_an_element_alone; - ann_custom_FirstLevelElement.reset(); - CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_FirstLevelElement); - CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); - TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_an_element_alone); - } - CompleteStructType struct_type_FirstLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_FirstLevelElement, header_FirstLevelElement, member_seq_FirstLevelElement); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_FirstLevelElement, type_name_FirstLevelElement.to_string(), type_ids_FirstLevelElement)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "FirstLevelElement already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_complex_nested_arrays_type_identifier( - TypeIdentifierPair& type_ids_complex_nested_arrays) -{ - - ReturnCode_t return_code_complex_nested_arrays {eprosima::fastdds::dds::RETCODE_OK}; - return_code_complex_nested_arrays = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "complex_nested_arrays", type_ids_complex_nested_arrays); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_complex_nested_arrays) - { - StructTypeFlag struct_flags_complex_nested_arrays = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_complex_nested_arrays = "complex_nested_arrays"; - eprosima::fastcdr::optional type_ann_builtin_complex_nested_arrays; - eprosima::fastcdr::optional ann_custom_complex_nested_arrays; - CompleteTypeDetail detail_complex_nested_arrays = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_complex_nested_arrays, ann_custom_complex_nested_arrays, type_name_complex_nested_arrays.to_string()); - CompleteStructHeader header_complex_nested_arrays; - header_complex_nested_arrays = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_complex_nested_arrays); - CompleteStructMemberSeq member_seq_complex_nested_arrays; - { - TypeIdentifierPair type_ids_array_of_elements; - ReturnCode_t return_code_array_of_elements {eprosima::fastdds::dds::RETCODE_OK}; - return_code_array_of_elements = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_FirstLevelElement_3", type_ids_array_of_elements); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_array_of_elements) - { - return_code_array_of_elements = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "FirstLevelElement", type_ids_array_of_elements); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_array_of_elements) - { - ::register_FirstLevelElement_type_identifier(type_ids_array_of_elements); - } - bool element_identifier_anonymous_array_FirstLevelElement_3_ec {false}; - TypeIdentifier* element_identifier_anonymous_array_FirstLevelElement_3 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_array_of_elements, element_identifier_anonymous_array_FirstLevelElement_3_ec))}; - if (!element_identifier_anonymous_array_FirstLevelElement_3_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_array_FirstLevelElement_3 = EK_COMPLETE; - if (TK_NONE == type_ids_array_of_elements.type_identifier2()._d()) - { - equiv_kind_anonymous_array_FirstLevelElement_3 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_array_FirstLevelElement_3 = 0; - PlainCollectionHeader header_anonymous_array_FirstLevelElement_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_FirstLevelElement_3, element_flags_anonymous_array_FirstLevelElement_3); - { - SBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); - - PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_FirstLevelElement_3, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_FirstLevelElement_3)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_FirstLevelElement_3", type_ids_array_of_elements)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_FirstLevelElement_3 already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_array_of_elements = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_array_of_elements = 0x00000000; - bool common_array_of_elements_ec {false}; - CommonStructMember common_array_of_elements {TypeObjectUtils::build_common_struct_member(member_id_array_of_elements, member_flags_array_of_elements, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_array_of_elements, common_array_of_elements_ec))}; - if (!common_array_of_elements_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure array_of_elements member TypeIdentifier inconsistent."); - return; - } - MemberName name_array_of_elements = "array_of_elements"; - eprosima::fastcdr::optional member_ann_builtin_array_of_elements; - ann_custom_complex_nested_arrays.reset(); - CompleteMemberDetail detail_array_of_elements = TypeObjectUtils::build_complete_member_detail(name_array_of_elements, member_ann_builtin_array_of_elements, ann_custom_complex_nested_arrays); - CompleteStructMember member_array_of_elements = TypeObjectUtils::build_complete_struct_member(common_array_of_elements, detail_array_of_elements); - TypeObjectUtils::add_complete_struct_member(member_seq_complex_nested_arrays, member_array_of_elements); - } - CompleteStructType struct_type_complex_nested_arrays = TypeObjectUtils::build_complete_struct_type(struct_flags_complex_nested_arrays, header_complex_nested_arrays, member_seq_complex_nested_arrays); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_complex_nested_arrays, type_name_complex_nested_arrays.to_string(), type_ids_complex_nested_arrays)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "complex_nested_arrays already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp deleted file mode 100644 index aec5bb21..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp +++ /dev/null @@ -1,92 +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 complex_nested_arraysTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_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 - -/** - * @brief Register ThirdLevelElement related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_ThirdLevelElement_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register SecondLevelElement related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_SecondLevelElement_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register FirstLevelElement related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_FirstLevelElement_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register complex_nested_arrays related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_complex_nested_arrays_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp deleted file mode 100644 index 3e39c043..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_struct.hpp +++ /dev/null @@ -1,225 +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 enum_struct.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__ENUM_STRUCT_HPP -#define FAST_DDS_GENERATED__ENUM_STRUCT_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(ENUM_STRUCT_SOURCE) -#define ENUM_STRUCT_DllAPI __declspec( dllexport ) -#else -#define ENUM_STRUCT_DllAPI __declspec( dllimport ) -#endif // ENUM_STRUCT_SOURCE -#else -#define ENUM_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define ENUM_STRUCT_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the enumeration ColorEnum defined by the user in the IDL file. - * @ingroup enum_struct - */ -enum class ColorEnum : int32_t -{ - RED, - GREEN, - BLUE -}; -/*! - * @brief This class represents the structure enum_struct defined by the user in the IDL file. - * @ingroup enum_struct - */ -class enum_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport enum_struct() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~enum_struct() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct( - const enum_struct& x) - { - m_index = x.m_index; - - m_enum_value = x.m_enum_value; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct( - enum_struct&& x) noexcept - { - m_index = x.m_index; - m_enum_value = x.m_enum_value; - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct& operator =( - const enum_struct& x) - { - - m_index = x.m_index; - - m_enum_value = x.m_enum_value; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object enum_struct that will be copied. - */ - eProsima_user_DllExport enum_struct& operator =( - enum_struct&& x) noexcept - { - - m_index = x.m_index; - m_enum_value = x.m_enum_value; - return *this; - } - - /*! - * @brief Comparison operator. - * @param x enum_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const enum_struct& x) const - { - return (m_index == x.m_index && - m_enum_value == x.m_enum_value); - } - - /*! - * @brief Comparison operator. - * @param x enum_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const enum_struct& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index) - { - m_index = _index; - } - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const - { - return m_index; - } - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index() - { - return m_index; - } - - - /*! - * @brief This function sets a value in member enum_value - * @param _enum_value New value for member enum_value - */ - eProsima_user_DllExport void enum_value( - ColorEnum _enum_value) - { - m_enum_value = _enum_value; - } - - /*! - * @brief This function returns the value of member enum_value - * @return Value of member enum_value - */ - eProsima_user_DllExport ColorEnum enum_value() const - { - return m_enum_value; - } - - /*! - * @brief This function returns a reference to member enum_value - * @return Reference to member enum_value - */ - eProsima_user_DllExport ColorEnum& enum_value() - { - return m_enum_value; - } - - - -private: - - uint32_t m_index{0}; - ColorEnum m_enum_value{ColorEnum::RED}; - -}; - -#endif // _FAST_DDS_GENERATED_ENUM_STRUCT_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp deleted file mode 100644 index 285c5fc7..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.hpp +++ /dev/null @@ -1,47 +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 enum_structCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_HPP -#define FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_HPP - -#include "enum_struct.hpp" - -constexpr uint32_t enum_struct_max_cdr_typesize {12UL}; -constexpr uint32_t enum_struct_max_key_cdr_typesize {0UL}; - - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const enum_struct& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp deleted file mode 100644 index 8a43f231..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structCdrAux.ipp +++ /dev/null @@ -1,126 +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 enum_structCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_IPP -#define FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_IPP - -#include "enum_structCdrAux.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 enum_struct& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.index(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.enum_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 enum_struct& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.index() - << eprosima::fastcdr::MemberId(1) << data.enum_value() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - enum_struct& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.index(); - break; - - case 1: - dcdr >> data.enum_value(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const enum_struct& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__ENUM_STRUCTCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx deleted file mode 100644 index a742fab7..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.cxx +++ /dev/null @@ -1,229 +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 enum_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "enum_structPubSubTypes.hpp" - -#include -#include - -#include "enum_structCdrAux.hpp" -#include "enum_structTypeObjectSupport.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; - -enum_structPubSubType::enum_structPubSubType() -{ - setName("enum_struct"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(enum_struct::getMaxCdrSerializedSize()); -#else - enum_struct_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = enum_struct_max_key_cdr_typesize > 16 ? enum_struct_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -enum_structPubSubType::~enum_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool enum_structPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const enum_struct* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool enum_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - enum_struct* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function enum_structPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* enum_structPubSubType::createData() -{ - return reinterpret_cast(new enum_struct()); -} - -void enum_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool enum_structPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const enum_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - enum_struct_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || enum_struct_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void enum_structPubSubType::register_type_object_representation() -{ - register_enum_struct_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "enum_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.hpp deleted file mode 100644 index b69dda7e..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structPubSubTypes.hpp +++ /dev/null @@ -1,133 +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 enum_structPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__ENUM_STRUCT_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__ENUM_STRUCT_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "enum_struct.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated enum_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type enum_struct defined by the user in the IDL file. - * @ingroup enum_struct - */ -class enum_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef enum_struct type; - - eProsima_user_DllExport enum_structPubSubType(); - - eProsima_user_DllExport ~enum_structPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__ENUM_STRUCT_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx deleted file mode 100644 index 642e3524..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.cxx +++ /dev/null @@ -1,185 +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 enum_structTypeObjectSupport.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. - */ - -#include "enum_structTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "enum_struct.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -void register_ColorEnum_type_identifier( - TypeIdentifierPair& type_ids_ColorEnum) -{ - ReturnCode_t return_code_ColorEnum {eprosima::fastdds::dds::RETCODE_OK}; - return_code_ColorEnum = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ColorEnum", type_ids_ColorEnum); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_ColorEnum) - { - EnumTypeFlag enum_flags_ColorEnum = 0; - BitBound bit_bound_ColorEnum = 32; - CommonEnumeratedHeader common_ColorEnum = TypeObjectUtils::build_common_enumerated_header(bit_bound_ColorEnum); - QualifiedTypeName type_name_ColorEnum = "ColorEnum"; - eprosima::fastcdr::optional type_ann_builtin_ColorEnum; - eprosima::fastcdr::optional ann_custom_ColorEnum; - CompleteTypeDetail detail_ColorEnum = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ColorEnum, ann_custom_ColorEnum, type_name_ColorEnum.to_string()); - CompleteEnumeratedHeader header_ColorEnum = TypeObjectUtils::build_complete_enumerated_header(common_ColorEnum, detail_ColorEnum); - CompleteEnumeratedLiteralSeq literal_seq_ColorEnum; - { - EnumeratedLiteralFlag flags_RED = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_RED = TypeObjectUtils::build_common_enumerated_literal(0, flags_RED); - eprosima::fastcdr::optional member_ann_builtin_RED; - ann_custom_ColorEnum.reset(); - MemberName name_RED = "RED"; - CompleteMemberDetail detail_RED = TypeObjectUtils::build_complete_member_detail(name_RED, member_ann_builtin_RED, ann_custom_ColorEnum); - CompleteEnumeratedLiteral literal_RED = TypeObjectUtils::build_complete_enumerated_literal(common_RED, detail_RED); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_RED); - } - { - EnumeratedLiteralFlag flags_GREEN = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_GREEN = TypeObjectUtils::build_common_enumerated_literal(1, flags_GREEN); - eprosima::fastcdr::optional member_ann_builtin_GREEN; - ann_custom_ColorEnum.reset(); - MemberName name_GREEN = "GREEN"; - CompleteMemberDetail detail_GREEN = TypeObjectUtils::build_complete_member_detail(name_GREEN, member_ann_builtin_GREEN, ann_custom_ColorEnum); - CompleteEnumeratedLiteral literal_GREEN = TypeObjectUtils::build_complete_enumerated_literal(common_GREEN, detail_GREEN); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_GREEN); - } - { - EnumeratedLiteralFlag flags_BLUE = TypeObjectUtils::build_enumerated_literal_flag(false); - CommonEnumeratedLiteral common_BLUE = TypeObjectUtils::build_common_enumerated_literal(2, flags_BLUE); - eprosima::fastcdr::optional member_ann_builtin_BLUE; - ann_custom_ColorEnum.reset(); - MemberName name_BLUE = "BLUE"; - CompleteMemberDetail detail_BLUE = TypeObjectUtils::build_complete_member_detail(name_BLUE, member_ann_builtin_BLUE, ann_custom_ColorEnum); - CompleteEnumeratedLiteral literal_BLUE = TypeObjectUtils::build_complete_enumerated_literal(common_BLUE, detail_BLUE); - TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ColorEnum, literal_BLUE); - } - CompleteEnumeratedType enumerated_type_ColorEnum = TypeObjectUtils::build_complete_enumerated_type(enum_flags_ColorEnum, header_ColorEnum, - literal_seq_ColorEnum); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_ColorEnum, type_name_ColorEnum.to_string(), type_ids_ColorEnum)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "ColorEnum already registered in TypeObjectRegistry for a different type."); - } - } -}// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_enum_struct_type_identifier( - TypeIdentifierPair& type_ids_enum_struct) -{ - - ReturnCode_t return_code_enum_struct {eprosima::fastdds::dds::RETCODE_OK}; - return_code_enum_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "enum_struct", type_ids_enum_struct); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_enum_struct) - { - StructTypeFlag struct_flags_enum_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_enum_struct = "enum_struct"; - eprosima::fastcdr::optional type_ann_builtin_enum_struct; - eprosima::fastcdr::optional ann_custom_enum_struct; - CompleteTypeDetail detail_enum_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_enum_struct, ann_custom_enum_struct, type_name_enum_struct.to_string()); - CompleteStructHeader header_enum_struct; - header_enum_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_enum_struct); - CompleteStructMemberSeq member_seq_enum_struct; - { - TypeIdentifierPair type_ids_index; - ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; - return_code_index = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_index); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_index = 0x00000000; - bool common_index_ec {false}; - CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; - if (!common_index_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); - return; - } - MemberName name_index = "index"; - eprosima::fastcdr::optional member_ann_builtin_index; - ann_custom_enum_struct.reset(); - CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_enum_struct); - CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); - TypeObjectUtils::add_complete_struct_member(member_seq_enum_struct, member_index); - } - { - TypeIdentifierPair type_ids_enum_value; - ReturnCode_t return_code_enum_value {eprosima::fastdds::dds::RETCODE_OK}; - return_code_enum_value = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "ColorEnum", type_ids_enum_value); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_enum_value) - { - ::register_ColorEnum_type_identifier(type_ids_enum_value); - } - StructMemberFlag member_flags_enum_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_enum_value = 0x00000001; - bool common_enum_value_ec {false}; - CommonStructMember common_enum_value {TypeObjectUtils::build_common_struct_member(member_id_enum_value, member_flags_enum_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_enum_value, common_enum_value_ec))}; - if (!common_enum_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure enum_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_enum_value = "enum_value"; - eprosima::fastcdr::optional member_ann_builtin_enum_value; - ann_custom_enum_struct.reset(); - CompleteMemberDetail detail_enum_value = TypeObjectUtils::build_complete_member_detail(name_enum_value, member_ann_builtin_enum_value, ann_custom_enum_struct); - CompleteStructMember member_enum_value = TypeObjectUtils::build_complete_struct_member(common_enum_value, detail_enum_value); - TypeObjectUtils::add_complete_struct_member(member_seq_enum_struct, member_enum_value); - } - CompleteStructType struct_type_enum_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_enum_struct, header_enum_struct, member_seq_enum_struct); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_enum_struct, type_name_enum_struct.to_string(), type_ids_enum_struct)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "enum_struct already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp deleted file mode 100644 index 70026eb9..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/enum_structTypeObjectSupport.hpp +++ /dev/null @@ -1,68 +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 enum_structTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__ENUM_STRUCT_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 - -/** - * @brief Register ColorEnum related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_ColorEnum_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register enum_struct related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_enum_struct_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__ENUM_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp deleted file mode 100644 index 641f52d9..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp +++ /dev/null @@ -1,190 +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 float_bounded_sequence.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_HPP -#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_HPP - -#include -#include -#include - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(FLOAT_BOUNDED_SEQUENCE_SOURCE) -#define FLOAT_BOUNDED_SEQUENCE_DllAPI __declspec( dllexport ) -#else -#define FLOAT_BOUNDED_SEQUENCE_DllAPI __declspec( dllimport ) -#endif // FLOAT_BOUNDED_SEQUENCE_SOURCE -#else -#define FLOAT_BOUNDED_SEQUENCE_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define FLOAT_BOUNDED_SEQUENCE_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure float_bounded_sequence defined by the user in the IDL file. - * @ingroup float_bounded_sequence - */ -class float_bounded_sequence -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport float_bounded_sequence() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~float_bounded_sequence() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence( - const float_bounded_sequence& x) - { - m_numbers = x.m_numbers; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence( - float_bounded_sequence&& x) noexcept - { - m_numbers = std::move(x.m_numbers); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence& operator =( - const float_bounded_sequence& x) - { - - m_numbers = x.m_numbers; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object float_bounded_sequence that will be copied. - */ - eProsima_user_DllExport float_bounded_sequence& operator =( - float_bounded_sequence&& x) noexcept - { - - m_numbers = std::move(x.m_numbers); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x float_bounded_sequence object to compare. - */ - eProsima_user_DllExport bool operator ==( - const float_bounded_sequence& x) const - { - return (m_numbers == x.m_numbers); - } - - /*! - * @brief Comparison operator. - * @param x float_bounded_sequence object to compare. - */ - eProsima_user_DllExport bool operator !=( - const float_bounded_sequence& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member numbers - * @param _numbers New value to be copied in member numbers - */ - eProsima_user_DllExport void numbers( - const std::vector& _numbers) - { - m_numbers = _numbers; - } - - /*! - * @brief This function moves the value in member numbers - * @param _numbers New value to be moved in member numbers - */ - eProsima_user_DllExport void numbers( - std::vector&& _numbers) - { - m_numbers = std::move(_numbers); - } - - /*! - * @brief This function returns a constant reference to member numbers - * @return Constant reference to member numbers - */ - eProsima_user_DllExport const std::vector& numbers() const - { - return m_numbers; - } - - /*! - * @brief This function returns a reference to member numbers - * @return Reference to member numbers - */ - eProsima_user_DllExport std::vector& numbers() - { - return m_numbers; - } - - - -private: - - std::vector m_numbers; - -}; - -#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp deleted file mode 100644 index d41f390b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.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 float_bounded_sequenceCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP -#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP - -#include "float_bounded_sequence.hpp" - -constexpr uint32_t float_bounded_sequence_max_cdr_typesize {60UL}; -constexpr uint32_t float_bounded_sequence_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const float_bounded_sequence& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp deleted file mode 100644 index a167cf15..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp +++ /dev/null @@ -1,118 +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 float_bounded_sequenceCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP -#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP - -#include "float_bounded_sequenceCdrAux.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 float_bounded_sequence& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.numbers(), 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 float_bounded_sequence& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.numbers() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - float_bounded_sequence& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.numbers(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const float_bounded_sequence& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx deleted file mode 100644 index 8c70ebed..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx +++ /dev/null @@ -1,229 +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 float_bounded_sequencePubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "float_bounded_sequencePubSubTypes.hpp" - -#include -#include - -#include "float_bounded_sequenceCdrAux.hpp" -#include "float_bounded_sequenceTypeObjectSupport.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; - -float_bounded_sequencePubSubType::float_bounded_sequencePubSubType() -{ - setName("float_bounded_sequence"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(float_bounded_sequence::getMaxCdrSerializedSize()); -#else - float_bounded_sequence_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = float_bounded_sequence_max_key_cdr_typesize > 16 ? float_bounded_sequence_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -float_bounded_sequencePubSubType::~float_bounded_sequencePubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool float_bounded_sequencePubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const float_bounded_sequence* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool float_bounded_sequencePubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - float_bounded_sequence* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function float_bounded_sequencePubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* float_bounded_sequencePubSubType::createData() -{ - return reinterpret_cast(new float_bounded_sequence()); -} - -void float_bounded_sequencePubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool float_bounded_sequencePubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const float_bounded_sequence* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - float_bounded_sequence_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || float_bounded_sequence_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void float_bounded_sequencePubSubType::register_type_object_representation() -{ - register_float_bounded_sequence_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "float_bounded_sequenceCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp deleted file mode 100644 index ffc3557f..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp +++ /dev/null @@ -1,133 +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 float_bounded_sequencePubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "float_bounded_sequence.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated float_bounded_sequence is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type float_bounded_sequence defined by the user in the IDL file. - * @ingroup float_bounded_sequence - */ -class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef float_bounded_sequence type; - - eProsima_user_DllExport float_bounded_sequencePubSubType(); - - eProsima_user_DllExport ~float_bounded_sequencePubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx deleted file mode 100644 index aa6108f6..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx +++ /dev/null @@ -1,132 +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 float_bounded_sequenceTypeObjectSupport.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. - */ - -#include "float_bounded_sequenceTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "float_bounded_sequence.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_float_bounded_sequence_type_identifier( - TypeIdentifierPair& type_ids_float_bounded_sequence) -{ - - ReturnCode_t return_code_float_bounded_sequence {eprosima::fastdds::dds::RETCODE_OK}; - return_code_float_bounded_sequence = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "float_bounded_sequence", type_ids_float_bounded_sequence); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_float_bounded_sequence) - { - StructTypeFlag struct_flags_float_bounded_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_float_bounded_sequence = "float_bounded_sequence"; - eprosima::fastcdr::optional type_ann_builtin_float_bounded_sequence; - eprosima::fastcdr::optional ann_custom_float_bounded_sequence; - CompleteTypeDetail detail_float_bounded_sequence = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_float_bounded_sequence, ann_custom_float_bounded_sequence, type_name_float_bounded_sequence.to_string()); - CompleteStructHeader header_float_bounded_sequence; - header_float_bounded_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_float_bounded_sequence); - CompleteStructMemberSeq member_seq_float_bounded_sequence; - { - TypeIdentifierPair type_ids_numbers; - ReturnCode_t return_code_numbers {eprosima::fastdds::dds::RETCODE_OK}; - return_code_numbers = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_sequence_float_13", type_ids_numbers); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_numbers) - { - return_code_numbers = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_float", type_ids_numbers); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_numbers) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - bool element_identifier_anonymous_sequence_float_13_ec {false}; - TypeIdentifier* element_identifier_anonymous_sequence_float_13 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_numbers, element_identifier_anonymous_sequence_float_13_ec))}; - if (!element_identifier_anonymous_sequence_float_13_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_sequence_float_13 = EK_COMPLETE; - if (TK_NONE == type_ids_numbers.type_identifier2()._d()) - { - equiv_kind_anonymous_sequence_float_13 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_sequence_float_13 = 0; - PlainCollectionHeader header_anonymous_sequence_float_13 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_float_13, element_flags_anonymous_sequence_float_13); - { - SBound bound = static_cast(13); - PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_float_13, bound, - eprosima::fastcdr::external(element_identifier_anonymous_sequence_float_13)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_float_13", type_ids_numbers)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_sequence_float_13 already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_numbers = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_numbers = 0x00000000; - bool common_numbers_ec {false}; - CommonStructMember common_numbers {TypeObjectUtils::build_common_struct_member(member_id_numbers, member_flags_numbers, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_numbers, common_numbers_ec))}; - if (!common_numbers_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure numbers member TypeIdentifier inconsistent."); - return; - } - MemberName name_numbers = "numbers"; - eprosima::fastcdr::optional member_ann_builtin_numbers; - ann_custom_float_bounded_sequence.reset(); - CompleteMemberDetail detail_numbers = TypeObjectUtils::build_complete_member_detail(name_numbers, member_ann_builtin_numbers, ann_custom_float_bounded_sequence); - CompleteStructMember member_numbers = TypeObjectUtils::build_complete_struct_member(common_numbers, detail_numbers); - TypeObjectUtils::add_complete_struct_member(member_seq_float_bounded_sequence, member_numbers); - } - CompleteStructType struct_type_float_bounded_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_float_bounded_sequence, header_float_bounded_sequence, member_seq_float_bounded_sequence); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_float_bounded_sequence, type_name_float_bounded_sequence.to_string(), type_ids_float_bounded_sequence)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "float_bounded_sequence already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp deleted file mode 100644 index 78dab6b6..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp +++ /dev/null @@ -1,56 +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 float_bounded_sequenceTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_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 - -/** - * @brief Register float_bounded_sequence related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_float_bounded_sequence_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp deleted file mode 100644 index 27ca777d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp +++ /dev/null @@ -1,227 +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 hello_world.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__HELLO_WORLD_HPP -#define FAST_DDS_GENERATED__HELLO_WORLD_HPP - -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(HELLO_WORLD_SOURCE) -#define HELLO_WORLD_DllAPI __declspec( dllexport ) -#else -#define HELLO_WORLD_DllAPI __declspec( dllimport ) -#endif // HELLO_WORLD_SOURCE -#else -#define HELLO_WORLD_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define HELLO_WORLD_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure hello_world defined by the user in the IDL file. - * @ingroup hello_world - */ -class hello_world -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport hello_world() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~hello_world() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world( - const hello_world& x) - { - m_index = x.m_index; - - m_message = x.m_message; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world( - hello_world&& x) noexcept - { - m_index = x.m_index; - m_message = std::move(x.m_message); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world& operator =( - const hello_world& x) - { - - m_index = x.m_index; - - m_message = x.m_message; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object hello_world that will be copied. - */ - eProsima_user_DllExport hello_world& operator =( - hello_world&& x) noexcept - { - - m_index = x.m_index; - m_message = std::move(x.m_message); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x hello_world object to compare. - */ - eProsima_user_DllExport bool operator ==( - const hello_world& x) const - { - return (m_index == x.m_index && - m_message == x.m_message); - } - - /*! - * @brief Comparison operator. - * @param x hello_world object to compare. - */ - eProsima_user_DllExport bool operator !=( - const hello_world& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index) - { - m_index = _index; - } - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const - { - return m_index; - } - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index() - { - return m_index; - } - - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::string& _message) - { - m_message = _message; - } - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::string&& _message) - { - m_message = std::move(_message); - } - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::string& message() const - { - return m_message; - } - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::string& message() - { - return m_message; - } - - - -private: - - uint32_t m_index{0}; - std::string m_message; - -}; - -#endif // _FAST_DDS_GENERATED_HELLO_WORLD_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp deleted file mode 100644 index 4837eee8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.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 hello_worldCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP -#define FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP - -#include "hello_world.hpp" - -constexpr uint32_t hello_world_max_cdr_typesize {268UL}; -constexpr uint32_t hello_world_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const hello_world& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp deleted file mode 100644 index fd4e9f07..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp +++ /dev/null @@ -1,126 +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 hello_worldCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP -#define FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP - -#include "hello_worldCdrAux.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 hello_world& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.index(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.message(), 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 hello_world& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.index() - << eprosima::fastcdr::MemberId(1) << data.message() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - hello_world& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.index(); - break; - - case 1: - dcdr >> data.message(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const hello_world& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx deleted file mode 100644 index f57610d0..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx +++ /dev/null @@ -1,229 +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 hello_worldPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "hello_worldPubSubTypes.hpp" - -#include -#include - -#include "hello_worldCdrAux.hpp" -#include "hello_worldTypeObjectSupport.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; - -hello_worldPubSubType::hello_worldPubSubType() -{ - setName("hello_world"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(hello_world::getMaxCdrSerializedSize()); -#else - hello_world_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = hello_world_max_key_cdr_typesize > 16 ? hello_world_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -hello_worldPubSubType::~hello_worldPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool hello_worldPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const hello_world* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool hello_worldPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - hello_world* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function hello_worldPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* hello_worldPubSubType::createData() -{ - return reinterpret_cast(new hello_world()); -} - -void hello_worldPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool hello_worldPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const hello_world* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - hello_world_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || hello_world_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void hello_worldPubSubType::register_type_object_representation() -{ - register_hello_world_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "hello_worldCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp deleted file mode 100644 index 47a4baa3..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp +++ /dev/null @@ -1,133 +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 hello_worldPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "hello_world.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated hello_world is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type hello_world defined by the user in the IDL file. - * @ingroup hello_world - */ -class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef hello_world type; - - eProsima_user_DllExport hello_worldPubSubType(); - - eProsima_user_DllExport ~hello_worldPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx deleted file mode 100644 index 1c19ab81..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx +++ /dev/null @@ -1,138 +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 hello_worldTypeObjectSupport.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. - */ - -#include "hello_worldTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hello_world.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_hello_world_type_identifier( - TypeIdentifierPair& type_ids_hello_world) -{ - - ReturnCode_t return_code_hello_world {eprosima::fastdds::dds::RETCODE_OK}; - return_code_hello_world = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "hello_world", type_ids_hello_world); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_hello_world) - { - StructTypeFlag struct_flags_hello_world = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_hello_world = "hello_world"; - eprosima::fastcdr::optional type_ann_builtin_hello_world; - eprosima::fastcdr::optional ann_custom_hello_world; - CompleteTypeDetail detail_hello_world = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_hello_world, ann_custom_hello_world, type_name_hello_world.to_string()); - CompleteStructHeader header_hello_world; - header_hello_world = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_hello_world); - CompleteStructMemberSeq member_seq_hello_world; - { - TypeIdentifierPair type_ids_index; - ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; - return_code_index = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_index); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_index = 0x00000000; - bool common_index_ec {false}; - CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; - if (!common_index_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); - return; - } - MemberName name_index = "index"; - eprosima::fastcdr::optional member_ann_builtin_index; - ann_custom_hello_world.reset(); - CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_hello_world); - CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); - TypeObjectUtils::add_complete_struct_member(member_seq_hello_world, member_index); - } - { - TypeIdentifierPair type_ids_message; - ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK}; - return_code_message = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_message); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) - { - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded", type_ids_message)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_message = 0x00000001; - bool common_message_ec {false}; - CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))}; - if (!common_message_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent."); - return; - } - MemberName name_message = "message"; - eprosima::fastcdr::optional member_ann_builtin_message; - ann_custom_hello_world.reset(); - CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_hello_world); - CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message); - TypeObjectUtils::add_complete_struct_member(member_seq_hello_world, member_message); - } - CompleteStructType struct_type_hello_world = TypeObjectUtils::build_complete_struct_type(struct_flags_hello_world, header_hello_world, member_seq_hello_world); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_hello_world, type_name_hello_world.to_string(), type_ids_hello_world)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "hello_world already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp deleted file mode 100644 index d0a80dd8..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp +++ /dev/null @@ -1,56 +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 hello_worldTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__HELLO_WORLD_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 - -/** - * @brief Register hello_world related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_hello_world_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp deleted file mode 100644 index cb2ed629..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_struct.hpp +++ /dev/null @@ -1,191 +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 map_struct.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__MAP_STRUCT_HPP -#define FAST_DDS_GENERATED__MAP_STRUCT_HPP - -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MAP_STRUCT_SOURCE) -#define MAP_STRUCT_DllAPI __declspec( dllexport ) -#else -#define MAP_STRUCT_DllAPI __declspec( dllimport ) -#endif // MAP_STRUCT_SOURCE -#else -#define MAP_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MAP_STRUCT_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure map_struct defined by the user in the IDL file. - * @ingroup map_struct - */ -class map_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport map_struct() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~map_struct() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct( - const map_struct& x) - { - m_my_map = x.m_my_map; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct( - map_struct&& x) noexcept - { - m_my_map = std::move(x.m_my_map); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct& operator =( - const map_struct& x) - { - - m_my_map = x.m_my_map; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object map_struct that will be copied. - */ - eProsima_user_DllExport map_struct& operator =( - map_struct&& x) noexcept - { - - m_my_map = std::move(x.m_my_map); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x map_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const map_struct& x) const - { - return (m_my_map == x.m_my_map); - } - - /*! - * @brief Comparison operator. - * @param x map_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const map_struct& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member my_map - * @param _my_map New value to be copied in member my_map - */ - eProsima_user_DllExport void my_map( - const std::map& _my_map) - { - m_my_map = _my_map; - } - - /*! - * @brief This function moves the value in member my_map - * @param _my_map New value to be moved in member my_map - */ - eProsima_user_DllExport void my_map( - std::map&& _my_map) - { - m_my_map = std::move(_my_map); - } - - /*! - * @brief This function returns a constant reference to member my_map - * @return Constant reference to member my_map - */ - eProsima_user_DllExport const std::map& my_map() const - { - return m_my_map; - } - - /*! - * @brief This function returns a reference to member my_map - * @return Reference to member my_map - */ - eProsima_user_DllExport std::map& my_map() - { - return m_my_map; - } - - - -private: - - std::map m_my_map; - -}; - -#endif // _FAST_DDS_GENERATED_MAP_STRUCT_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.hpp deleted file mode 100644 index bb78ac3b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.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 map_structCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_HPP -#define FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_HPP - -#include "map_struct.hpp" - -constexpr uint32_t map_struct_max_cdr_typesize {8UL}; -constexpr uint32_t map_struct_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const map_struct& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp deleted file mode 100644 index 2fc10980..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structCdrAux.ipp +++ /dev/null @@ -1,118 +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 map_structCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_IPP -#define FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_IPP - -#include "map_structCdrAux.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 map_struct& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.my_map(), 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 map_struct& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.my_map() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - map_struct& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.my_map(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const map_struct& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__MAP_STRUCTCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx deleted file mode 100644 index 4b3396a9..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.cxx +++ /dev/null @@ -1,229 +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 map_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "map_structPubSubTypes.hpp" - -#include -#include - -#include "map_structCdrAux.hpp" -#include "map_structTypeObjectSupport.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; - -map_structPubSubType::map_structPubSubType() -{ - setName("map_struct"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(map_struct::getMaxCdrSerializedSize()); -#else - map_struct_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = map_struct_max_key_cdr_typesize > 16 ? map_struct_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -map_structPubSubType::~map_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool map_structPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const map_struct* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool map_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - map_struct* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function map_structPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* map_structPubSubType::createData() -{ - return reinterpret_cast(new map_struct()); -} - -void map_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool map_structPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const map_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - map_struct_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || map_struct_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void map_structPubSubType::register_type_object_representation() -{ - register_map_struct_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "map_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.hpp deleted file mode 100644 index d9edf340..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structPubSubTypes.hpp +++ /dev/null @@ -1,133 +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 map_structPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__MAP_STRUCT_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__MAP_STRUCT_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "map_struct.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated map_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type map_struct defined by the user in the IDL file. - * @ingroup map_struct - */ -class map_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef map_struct type; - - eProsima_user_DllExport map_structPubSubType(); - - eProsima_user_DllExport ~map_structPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__MAP_STRUCT_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx deleted file mode 100644 index e4d4e981..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.cxx +++ /dev/null @@ -1,167 +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 map_structTypeObjectSupport.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. - */ - -#include "map_structTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "map_struct.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_map_struct_type_identifier( - TypeIdentifierPair& type_ids_map_struct) -{ - - ReturnCode_t return_code_map_struct {eprosima::fastdds::dds::RETCODE_OK}; - return_code_map_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "map_struct", type_ids_map_struct); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_map_struct) - { - StructTypeFlag struct_flags_map_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_map_struct = "map_struct"; - eprosima::fastcdr::optional type_ann_builtin_map_struct; - eprosima::fastcdr::optional ann_custom_map_struct; - CompleteTypeDetail detail_map_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_map_struct, ann_custom_map_struct, type_name_map_struct.to_string()); - CompleteStructHeader header_map_struct; - header_map_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_map_struct); - CompleteStructMemberSeq member_seq_map_struct; - { - TypeIdentifierPair type_ids_my_map; - ReturnCode_t return_code_my_map {eprosima::fastdds::dds::RETCODE_OK}; - return_code_my_map = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_my_map); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_my_map) - { - return_code_my_map = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_bool", type_ids_my_map); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_my_map) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Map element TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - bool element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec {false}; - TypeIdentifier* element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_my_map, element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec))}; - if (!element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_map_anonymous_string_unbounded_bool_unbounded inconsistent element TypeIdentifier."); - return; - } - return_code_my_map = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_my_map); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_my_map) - { - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded", type_ids_my_map)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - bool key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec {false}; - TypeIdentifier* key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_my_map, key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec))}; - if (!key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_map_anonymous_string_unbounded_bool_unbounded inconsistent key TypeIdentifier."); - return; - } - EquivalenceKind equiv_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded = EK_BOTH; - if ((EK_COMPLETE == key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() || EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d()) || - (TI_PLAIN_SEQUENCE_SMALL == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->seq_sdefn().header().equiv_kind()) || - (TI_PLAIN_SEQUENCE_LARGE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->seq_ldefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_SMALL == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->array_sdefn().header().equiv_kind()) || - (TI_PLAIN_ARRAY_LARGE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && (EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_sdefn().key_identifier()->_d() || EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_sdefn().header().equiv_kind())) || - (TI_PLAIN_MAP_LARGE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->_d() && (EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_ldefn().key_identifier()->_d() || EK_COMPLETE == element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded->map_ldefn().header().equiv_kind()))) - { - equiv_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded = EK_COMPLETE; - } - CollectionElementFlag element_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded = 0; - CollectionElementFlag key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded = 0; - PlainCollectionHeader header_anonymous_map_anonymous_string_unbounded_bool_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_map_anonymous_string_unbounded_bool_unbounded, element_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded); - { - SBound bound = 0; - PlainMapSTypeDefn map_sdefn = TypeObjectUtils::build_plain_map_s_type_defn(header_anonymous_map_anonymous_string_unbounded_bool_unbounded, bound, - eprosima::fastcdr::external(element_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded), key_flags_anonymous_map_anonymous_string_unbounded_bool_unbounded, - eprosima::fastcdr::external(key_identifier_anonymous_map_anonymous_string_unbounded_bool_unbounded)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_map_type_identifier(map_sdefn, "anonymous_map_anonymous_string_unbounded_bool_unbounded", type_ids_my_map)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_map_anonymous_string_unbounded_bool_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_my_map = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_my_map = 0x00000000; - bool common_my_map_ec {false}; - CommonStructMember common_my_map {TypeObjectUtils::build_common_struct_member(member_id_my_map, member_flags_my_map, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_my_map, common_my_map_ec))}; - if (!common_my_map_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure my_map member TypeIdentifier inconsistent."); - return; - } - MemberName name_my_map = "my_map"; - eprosima::fastcdr::optional member_ann_builtin_my_map; - ann_custom_map_struct.reset(); - CompleteMemberDetail detail_my_map = TypeObjectUtils::build_complete_member_detail(name_my_map, member_ann_builtin_my_map, ann_custom_map_struct); - CompleteStructMember member_my_map = TypeObjectUtils::build_complete_struct_member(common_my_map, detail_my_map); - TypeObjectUtils::add_complete_struct_member(member_seq_map_struct, member_my_map); - } - CompleteStructType struct_type_map_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_map_struct, header_map_struct, member_seq_map_struct); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_map_struct, type_name_map_struct.to_string(), type_ids_map_struct)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "map_struct already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp deleted file mode 100644 index 6a1a1e1d..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/map_structTypeObjectSupport.hpp +++ /dev/null @@ -1,56 +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 map_structTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__MAP_STRUCT_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 - -/** - * @brief Register map_struct related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_map_struct_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__MAP_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp deleted file mode 100644 index a78917ad..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp +++ /dev/null @@ -1,189 +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 numeric_array.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_HPP -#define FAST_DDS_GENERATED__NUMERIC_ARRAY_HPP - -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(NUMERIC_ARRAY_SOURCE) -#define NUMERIC_ARRAY_DllAPI __declspec( dllexport ) -#else -#define NUMERIC_ARRAY_DllAPI __declspec( dllimport ) -#endif // NUMERIC_ARRAY_SOURCE -#else -#define NUMERIC_ARRAY_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define NUMERIC_ARRAY_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the structure numeric_array defined by the user in the IDL file. - * @ingroup numeric_array - */ -class numeric_array -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport numeric_array() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~numeric_array() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array( - const numeric_array& x) - { - m_points = x.m_points; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array( - numeric_array&& x) noexcept - { - m_points = std::move(x.m_points); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array& operator =( - const numeric_array& x) - { - - m_points = x.m_points; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object numeric_array that will be copied. - */ - eProsima_user_DllExport numeric_array& operator =( - numeric_array&& x) noexcept - { - - m_points = std::move(x.m_points); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x numeric_array object to compare. - */ - eProsima_user_DllExport bool operator ==( - const numeric_array& x) const - { - return (m_points == x.m_points); - } - - /*! - * @brief Comparison operator. - * @param x numeric_array object to compare. - */ - eProsima_user_DllExport bool operator !=( - const numeric_array& x) const - { - return !(*this == x); - } - - /*! - * @brief This function copies the value in member points - * @param _points New value to be copied in member points - */ - eProsima_user_DllExport void points( - const std::array& _points) - { - m_points = _points; - } - - /*! - * @brief This function moves the value in member points - * @param _points New value to be moved in member points - */ - eProsima_user_DllExport void points( - std::array&& _points) - { - m_points = std::move(_points); - } - - /*! - * @brief This function returns a constant reference to member points - * @return Constant reference to member points - */ - eProsima_user_DllExport const std::array& points() const - { - return m_points; - } - - /*! - * @brief This function returns a reference to member points - * @return Reference to member points - */ - eProsima_user_DllExport std::array& points() - { - return m_points; - } - - - -private: - - std::array m_points{0}; - -}; - -#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp deleted file mode 100644 index a00c7007..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.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 numeric_arrayCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP -#define FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP - -#include "numeric_array.hpp" - -constexpr uint32_t numeric_array_max_cdr_typesize {16UL}; -constexpr uint32_t numeric_array_max_key_cdr_typesize {0UL}; - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const numeric_array& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp deleted file mode 100644 index a6c384ed..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp +++ /dev/null @@ -1,118 +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 numeric_arrayCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP -#define FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP - -#include "numeric_arrayCdrAux.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 numeric_array& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.points(), 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 numeric_array& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.points() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - numeric_array& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.points(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const numeric_array& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx deleted file mode 100644 index 66b7701c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx +++ /dev/null @@ -1,229 +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 numeric_arrayPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "numeric_arrayPubSubTypes.hpp" - -#include -#include - -#include "numeric_arrayCdrAux.hpp" -#include "numeric_arrayTypeObjectSupport.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; - -numeric_arrayPubSubType::numeric_arrayPubSubType() -{ - setName("numeric_array"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(numeric_array::getMaxCdrSerializedSize()); -#else - numeric_array_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = numeric_array_max_key_cdr_typesize > 16 ? numeric_array_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -numeric_arrayPubSubType::~numeric_arrayPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool numeric_arrayPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const numeric_array* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool numeric_arrayPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - numeric_array* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function numeric_arrayPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* numeric_arrayPubSubType::createData() -{ - return reinterpret_cast(new numeric_array()); -} - -void numeric_arrayPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool numeric_arrayPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const numeric_array* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - numeric_array_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || numeric_array_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void numeric_arrayPubSubType::register_type_object_representation() -{ - register_numeric_array_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "numeric_arrayCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp deleted file mode 100644 index d65cea0b..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp +++ /dev/null @@ -1,133 +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 numeric_arrayPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "numeric_array.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated numeric_array is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type numeric_array defined by the user in the IDL file. - * @ingroup numeric_array - */ -class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef numeric_array type; - - eProsima_user_DllExport numeric_arrayPubSubType(); - - eProsima_user_DllExport ~numeric_arrayPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx deleted file mode 100644 index 22b35f27..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx +++ /dev/null @@ -1,134 +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 numeric_arrayTypeObjectSupport.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. - */ - -#include "numeric_arrayTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "numeric_array.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_numeric_array_type_identifier( - TypeIdentifierPair& type_ids_numeric_array) -{ - - ReturnCode_t return_code_numeric_array {eprosima::fastdds::dds::RETCODE_OK}; - return_code_numeric_array = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "numeric_array", type_ids_numeric_array); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_numeric_array) - { - StructTypeFlag struct_flags_numeric_array = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_numeric_array = "numeric_array"; - eprosima::fastcdr::optional type_ann_builtin_numeric_array; - eprosima::fastcdr::optional ann_custom_numeric_array; - CompleteTypeDetail detail_numeric_array = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_numeric_array, ann_custom_numeric_array, type_name_numeric_array.to_string()); - CompleteStructHeader header_numeric_array; - header_numeric_array = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_numeric_array); - CompleteStructMemberSeq member_seq_numeric_array; - { - TypeIdentifierPair type_ids_points; - ReturnCode_t return_code_points {eprosima::fastdds::dds::RETCODE_OK}; - return_code_points = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_array_int32_t_3", type_ids_points); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_points) - { - return_code_points = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_points); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_points) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Array element TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - bool element_identifier_anonymous_array_int32_t_3_ec {false}; - TypeIdentifier* element_identifier_anonymous_array_int32_t_3 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_points, element_identifier_anonymous_array_int32_t_3_ec))}; - if (!element_identifier_anonymous_array_int32_t_3_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); - return; - } - EquivalenceKind equiv_kind_anonymous_array_int32_t_3 = EK_COMPLETE; - if (TK_NONE == type_ids_points.type_identifier2()._d()) - { - equiv_kind_anonymous_array_int32_t_3 = EK_BOTH; - } - CollectionElementFlag element_flags_anonymous_array_int32_t_3 = 0; - PlainCollectionHeader header_anonymous_array_int32_t_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_int32_t_3, element_flags_anonymous_array_int32_t_3); - { - SBoundSeq array_bound_seq; - TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); - - PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_int32_t_3, array_bound_seq, - eprosima::fastcdr::external(element_identifier_anonymous_array_int32_t_3)); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_int32_t_3", type_ids_points)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_array_int32_t_3 already registered in TypeObjectRegistry for a different type."); - } - } - } - StructMemberFlag member_flags_points = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_points = 0x00000000; - bool common_points_ec {false}; - CommonStructMember common_points {TypeObjectUtils::build_common_struct_member(member_id_points, member_flags_points, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_points, common_points_ec))}; - if (!common_points_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure points member TypeIdentifier inconsistent."); - return; - } - MemberName name_points = "points"; - eprosima::fastcdr::optional member_ann_builtin_points; - ann_custom_numeric_array.reset(); - CompleteMemberDetail detail_points = TypeObjectUtils::build_complete_member_detail(name_points, member_ann_builtin_points, ann_custom_numeric_array); - CompleteStructMember member_points = TypeObjectUtils::build_complete_struct_member(common_points, detail_points); - TypeObjectUtils::add_complete_struct_member(member_seq_numeric_array, member_points); - } - CompleteStructType struct_type_numeric_array = TypeObjectUtils::build_complete_struct_type(struct_flags_numeric_array, header_numeric_array, member_seq_numeric_array); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_numeric_array, type_name_numeric_array.to_string(), type_ids_numeric_array)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "numeric_array already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp deleted file mode 100644 index b6219fd7..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp +++ /dev/null @@ -1,56 +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 numeric_arrayTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__NUMERIC_ARRAY_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 - -/** - * @brief Register numeric_array related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_numeric_array_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp deleted file mode 100644 index 4ec3a99c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_struct.hpp +++ /dev/null @@ -1,676 +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 union_struct.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__UNION_STRUCT_HPP -#define FAST_DDS_GENERATED__UNION_STRUCT_HPP - -#include -#include -#include -#include -#include -#include - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(UNION_STRUCT_SOURCE) -#define UNION_STRUCT_DllAPI __declspec( dllexport ) -#else -#define UNION_STRUCT_DllAPI __declspec( dllimport ) -#endif // UNION_STRUCT_SOURCE -#else -#define UNION_STRUCT_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define UNION_STRUCT_DllAPI -#endif // _WIN32 - -/*! - * @brief This class represents the union MyUnion defined by the user in the IDL file. - * @ingroup union_struct - */ -class MyUnion -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MyUnion() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MyUnion() - { - if (member_destructor_) - { - member_destructor_(); - } - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - const MyUnion& x) - { - m__d = x.m__d; - - switch (x.selected_member_) - { - case 0x00000001: - octet_value_() = x.m_octet_value; - break; - - case 0x00000002: - long_value_() = x.m_long_value; - break; - - case 0x00000003: - string_value_() = x.m_string_value; - break; - - } - } - - /*! - * @brief Move constructor. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion( - MyUnion&& x) noexcept - { - m__d = x.m__d; - - switch (x.selected_member_) - { - case 0x00000001: - octet_value_() = std::move(x.m_octet_value); - break; - - case 0x00000002: - long_value_() = std::move(x.m_long_value); - break; - - case 0x00000003: - string_value_() = std::move(x.m_string_value); - break; - - } - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - const MyUnion& x) - { - m__d = x.m__d; - - switch (x.selected_member_) - { - case 0x00000001: - octet_value_() = x.m_octet_value; - break; - - case 0x00000002: - long_value_() = x.m_long_value; - break; - - case 0x00000003: - string_value_() = x.m_string_value; - break; - - } - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object MyUnion that will be copied. - */ - eProsima_user_DllExport MyUnion& operator =( - MyUnion&& x) noexcept - { - m__d = x.m__d; - - switch (x.selected_member_) - { - case 0x00000001: - octet_value_() = std::move(x.m_octet_value); - break; - - case 0x00000002: - long_value_() = std::move(x.m_long_value); - break; - - case 0x00000003: - string_value_() = std::move(x.m_string_value); - break; - - } - - return *this; - } - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MyUnion& x) const - { - bool ret_value {false}; - - if (m__d == x.m__d && - selected_member_ == x.selected_member_) - { - switch (selected_member_) - { - case 0x00000001: - ret_value = (m_octet_value == x.m_octet_value); - break; - - case 0x00000002: - ret_value = (m_long_value == x.m_long_value); - break; - - case 0x00000003: - ret_value = (m_string_value == x.m_string_value); - break; - - } - } - - return ret_value; - } - - /*! - * @brief Comparison operator. - * @param x MyUnion object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MyUnion& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - int32_t __d) - { - bool valid_discriminator = false; - - switch (__d) - { - case 1: - if (0x00000001 == selected_member_) - { - valid_discriminator = true; - } - break; - - case 2: - if (0x00000002 == selected_member_) - { - valid_discriminator = true; - } - break; - - case 3: - if (0x00000003 == selected_member_) - { - valid_discriminator = true; - } - break; - - } - - if (!valid_discriminator) - { - throw eprosima::fastcdr::exception::BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; - } - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport int32_t _d() const - { - return m__d; - } - - /*! - * @brief This function sets a value in member octet_value - * @param _octet_value New value for member octet_value - */ - eProsima_user_DllExport void octet_value( - uint8_t _octet_value) - { - octet_value_() = _octet_value; - m__d = 1; - } - - /*! - * @brief This function returns the value of member octet_value - * @return Value of member octet_value - * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t octet_value() const - { - if (0x00000001 != selected_member_) - { - throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); - } - - return m_octet_value; - } - - /*! - * @brief This function returns a reference to member octet_value - * @return Reference to member octet_value - * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t& octet_value() - { - if (0x00000001 != selected_member_) - { - throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); - } - - return m_octet_value; - } - - - /*! - * @brief This function sets a value in member long_value - * @param _long_value New value for member long_value - */ - eProsima_user_DllExport void long_value( - int32_t _long_value) - { - long_value_() = _long_value; - m__d = 2; - } - - /*! - * @brief This function returns the value of member long_value - * @return Value of member long_value - * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t long_value() const - { - if (0x00000002 != selected_member_) - { - throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); - } - - return m_long_value; - } - - /*! - * @brief This function returns a reference to member long_value - * @return Reference to member long_value - * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport int32_t& long_value() - { - if (0x00000002 != selected_member_) - { - throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); - } - - return m_long_value; - } - - - /*! - * @brief This function copies the value in member string_value - * @param _string_value New value to be copied in member string_value - */ - eProsima_user_DllExport void string_value( - const std::string& _string_value) - { - string_value_() = _string_value; - m__d = 3; - } - - /*! - * @brief This function moves the value in member string_value - * @param _string_value New value to be moved in member string_value - */ - eProsima_user_DllExport void string_value( - std::string&& _string_value) - { - string_value_() = _string_value; - m__d = 3; - } - - /*! - * @brief This function returns a constant reference to member string_value - * @return Constant reference to member string_value - * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::string& string_value() const - { - if (0x00000003 != selected_member_) - { - throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); - } - - return m_string_value; - } - - /*! - * @brief This function returns a reference to member string_value - * @return Reference to member string_value - * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::string& string_value() - { - if (0x00000003 != selected_member_) - { - throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); - } - - return m_string_value; - } - - - void _default() - { - if (member_destructor_) - { - member_destructor_(); - } - - selected_member_ = 0x0FFFFFFFu; - } - - -private: - - uint8_t& octet_value_() - { - if (0x00000001 != selected_member_) - { - if (member_destructor_) - { - member_destructor_(); - } - - selected_member_ = 0x00000001; - member_destructor_ = nullptr; - m_octet_value = {0}; - ; - } - - return m_octet_value; - } - - int32_t& long_value_() - { - if (0x00000002 != selected_member_) - { - if (member_destructor_) - { - member_destructor_(); - } - - selected_member_ = 0x00000002; - member_destructor_ = nullptr; - m_long_value = {0}; - ; - } - - return m_long_value; - } - - std::string& string_value_() - { - if (0x00000003 != selected_member_) - { - if (member_destructor_) - { - member_destructor_(); - } - - selected_member_ = 0x00000003; - member_destructor_ = [&]() {m_string_value.~basic_string();}; - new(&m_string_value) std::string(); - ; - } - - return m_string_value; - } - - - int32_t m__d {0}; - - union - { - uint8_t m_octet_value; - int32_t m_long_value; - std::string m_string_value; - }; - - uint32_t selected_member_ {0x0FFFFFFFu}; - - std::function member_destructor_; -}; -/*! - * @brief This class represents the structure union_struct defined by the user in the IDL file. - * @ingroup union_struct - */ -class union_struct -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport union_struct() - { - } - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~union_struct() - { - } - - /*! - * @brief Copy constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - const union_struct& x) - { - m_index = x.m_index; - - m_union_value = x.m_union_value; - - } - - /*! - * @brief Move constructor. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct( - union_struct&& x) noexcept - { - m_index = x.m_index; - m_union_value = std::move(x.m_union_value); - } - - /*! - * @brief Copy assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - const union_struct& x) - { - - m_index = x.m_index; - - m_union_value = x.m_union_value; - - return *this; - } - - /*! - * @brief Move assignment. - * @param x Reference to the object union_struct that will be copied. - */ - eProsima_user_DllExport union_struct& operator =( - union_struct&& x) noexcept - { - - m_index = x.m_index; - m_union_value = std::move(x.m_union_value); - return *this; - } - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator ==( - const union_struct& x) const - { - return (m_index == x.m_index && - m_union_value == x.m_union_value); - } - - /*! - * @brief Comparison operator. - * @param x union_struct object to compare. - */ - eProsima_user_DllExport bool operator !=( - const union_struct& x) const - { - return !(*this == x); - } - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index) - { - m_index = _index; - } - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const - { - return m_index; - } - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index() - { - return m_index; - } - - - /*! - * @brief This function copies the value in member union_value - * @param _union_value New value to be copied in member union_value - */ - eProsima_user_DllExport void union_value( - const MyUnion& _union_value) - { - m_union_value = _union_value; - } - - /*! - * @brief This function moves the value in member union_value - * @param _union_value New value to be moved in member union_value - */ - eProsima_user_DllExport void union_value( - MyUnion&& _union_value) - { - m_union_value = std::move(_union_value); - } - - /*! - * @brief This function returns a constant reference to member union_value - * @return Constant reference to member union_value - */ - eProsima_user_DllExport const MyUnion& union_value() const - { - return m_union_value; - } - - /*! - * @brief This function returns a reference to member union_value - * @return Reference to member union_value - */ - eProsima_user_DllExport MyUnion& union_value() - { - return m_union_value; - } - - - -private: - - uint32_t m_index{0}; - MyUnion m_union_value; - -}; - -#endif // _FAST_DDS_GENERATED_UNION_STRUCT_HPP_ - - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp deleted file mode 100644 index 6a6d3b85..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.hpp +++ /dev/null @@ -1,47 +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 union_structCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_HPP -#define FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_HPP - -#include "union_struct.hpp" - -constexpr uint32_t union_struct_max_cdr_typesize {276UL}; -constexpr uint32_t union_struct_max_key_cdr_typesize {0UL}; - - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - -eProsima_user_DllExport void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const union_struct& data); - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp deleted file mode 100644 index 372fcc5a..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structCdrAux.ipp +++ /dev/null @@ -1,277 +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 union_structCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen. - */ - -#ifndef FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_IPP -#define FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_IPP - -#include "union_structCdrAux.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 MyUnion& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), data._d(), - current_alignment); - - switch (data._d()) - { - case 1: - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.octet_value(), current_alignment); - break; - - case 2: - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), - data.long_value(), current_alignment); - break; - - case 3: - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), - data.string_value(), current_alignment); - break; - - default: - break; - } - - 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 MyUnion& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr << eprosima::fastcdr::MemberId(0) << data._d(); - - switch (data._d()) - { - case 1: - scdr << eprosima::fastcdr::MemberId(1) << data.octet_value(); - break; - - case 2: - scdr << eprosima::fastcdr::MemberId(2) << data.long_value(); - break; - - case 3: - scdr << eprosima::fastcdr::MemberId(3) << data.string_value(); - break; - - default: - break; - } - - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - MyUnion& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - if (0 == mid.id) - { - int32_t discriminator; - dcdr >> discriminator; - - switch (discriminator) - { - case 1: - { - uint8_t octet_value_value{0}; - data.octet_value(std::move(octet_value_value)); - data._d(discriminator); - break; - } - - case 2: - { - int32_t long_value_value{0}; - data.long_value(std::move(long_value_value)); - data._d(discriminator); - break; - } - - case 3: - { - std::string string_value_value; - data.string_value(std::move(string_value_value)); - data._d(discriminator); - break; - } - - default: - data._default(); - break; - } - } - else - { - switch (data._d()) - { - case 1: - dcdr >> data.octet_value(); - break; - - case 2: - dcdr >> data.long_value(); - break; - - case 3: - dcdr >> data.string_value(); - break; - - default: - break; - } - ret_value = false; - } - return ret_value; - }); -} - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const union_struct& data, - size_t& current_alignment) -{ - 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::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.index(), current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.union_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 union_struct& data) -{ - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.index() - << eprosima::fastcdr::MemberId(1) << data.union_value() -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - union_struct& data) -{ - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.index(); - break; - - case 1: - dcdr >> data.union_value(); - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const union_struct& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__UNION_STRUCTCDRAUX_IPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx deleted file mode 100644 index 7a2ddc63..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.cxx +++ /dev/null @@ -1,229 +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 union_structPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - -#include "union_structPubSubTypes.hpp" - -#include -#include - -#include "union_structCdrAux.hpp" -#include "union_structTypeObjectSupport.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; - -union_structPubSubType::union_structPubSubType() -{ - setName("union_struct"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(union_struct::getMaxCdrSerializedSize()); -#else - union_struct_max_cdr_typesize; -#endif - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = union_struct_max_key_cdr_typesize > 16 ? union_struct_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -union_structPubSubType::~union_structPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool union_structPubSubType::serialize( - const void* const data, - SerializedPayload_t* payload, - DataRepresentationId_t data_representation) -{ - const union_struct* 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; -#if FASTCDR_VERSION_MAJOR > 1 - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 - return true; -} - -bool union_structPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - union_struct* 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); - - // 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; -} - -std::function union_structPubSubType::getSerializedSizeProvider( - const void* const data, - DataRepresentationId_t data_representation) -{ - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; -} - -void* union_structPubSubType::createData() -{ - return reinterpret_cast(new union_struct()); -} - -void union_structPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool union_structPubSubType::getKey( - const void* const data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - const union_struct* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - union_struct_max_key_cdr_typesize); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else - eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 - if (force_md5 || union_struct_max_key_cdr_typesize > 16) - { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} - -void union_structPubSubType::register_type_object_representation() -{ - register_union_struct_type_identifier(type_identifiers_); -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "union_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.hpp deleted file mode 100644 index 29fdef4c..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structPubSubTypes.hpp +++ /dev/null @@ -1,133 +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 union_structPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef FAST_DDS_GENERATED__UNION_STRUCT_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__UNION_STRUCT_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "union_struct.hpp" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated union_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -/*! - * @brief This class represents the TopicDataType of the type union_struct defined by the user in the IDL file. - * @ingroup union_struct - */ -class union_structPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef union_struct type; - - eProsima_user_DllExport union_structPubSubType(); - - eProsima_user_DllExport ~union_structPubSubType() override; - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - //Register TypeObject representation in Fast DDS TypeObjectRegistry - eProsima_user_DllExport void register_type_object_representation() override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; - -}; - -#endif // FAST_DDS_GENERATED__UNION_STRUCT_PUBSUBTYPES_HPP - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx deleted file mode 100644 index fd7ed407..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.cxx +++ /dev/null @@ -1,291 +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 union_structTypeObjectSupport.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. - */ - -#include "union_structTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "union_struct.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_MyUnion_type_identifier( - TypeIdentifierPair& type_ids_MyUnion) -{ - ReturnCode_t return_code_MyUnion {eprosima::fastdds::dds::RETCODE_OK}; - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MyUnion", type_ids_MyUnion); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) - { - UnionTypeFlag union_flags_MyUnion = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_MyUnion = "MyUnion"; - eprosima::fastcdr::optional type_ann_builtin_MyUnion; - eprosima::fastcdr::optional ann_custom_MyUnion; - CompleteTypeDetail detail_MyUnion = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MyUnion, ann_custom_MyUnion, type_name_MyUnion.to_string()); - CompleteUnionHeader header_MyUnion = TypeObjectUtils::build_complete_union_header(detail_MyUnion); - UnionDiscriminatorFlag member_flags_MyUnion = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false); - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_MyUnion); - - if (return_code_MyUnion != eprosima::fastdds::dds::RETCODE_OK) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "Union discriminator TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - CommonDiscriminatorMember common_MyUnion; - if (EK_COMPLETE == type_ids_MyUnion.type_identifier1()._d() || TK_NONE == type_ids_MyUnion.type_identifier2()._d()) - { - common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier1()); - } - else if (EK_COMPLETE == type_ids_MyUnion.type_identifier2()._d()) - { - common_MyUnion = TypeObjectUtils::build_common_discriminator_member(member_flags_MyUnion, type_ids_MyUnion.type_identifier2()); - } - else - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MyUnion discriminator TypeIdentifier inconsistent."); - return; - } - type_ann_builtin_MyUnion.reset(); - ann_custom_MyUnion.reset(); - CompleteDiscriminatorMember discriminator_MyUnion = TypeObjectUtils::build_complete_discriminator_member(common_MyUnion, - type_ann_builtin_MyUnion, ann_custom_MyUnion); - CompleteUnionMemberSeq member_seq_MyUnion; - { - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_byte", type_ids_MyUnion); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "octet_value Union member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - UnionMemberFlag member_flags_octet_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false); - UnionCaseLabelSeq label_seq_octet_value; - TypeObjectUtils::add_union_case_label(label_seq_octet_value, static_cast(1)); - MemberId member_id_octet_value = 0x00000001; - bool common_octet_value_ec {false}; - CommonUnionMember common_octet_value {TypeObjectUtils::build_common_union_member(member_id_octet_value, - member_flags_octet_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MyUnion, - common_octet_value_ec), label_seq_octet_value)}; - if (!common_octet_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union octet_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_octet_value = "octet_value"; - eprosima::fastcdr::optional member_ann_builtin_octet_value; - ann_custom_MyUnion.reset(); - CompleteMemberDetail detail_octet_value = TypeObjectUtils::build_complete_member_detail(name_octet_value, member_ann_builtin_octet_value, ann_custom_MyUnion); - CompleteUnionMember member_octet_value = TypeObjectUtils::build_complete_union_member(common_octet_value, detail_octet_value); - TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_octet_value); - } - { - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_int32_t", type_ids_MyUnion); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "long_value Union member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - UnionMemberFlag member_flags_long_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false); - UnionCaseLabelSeq label_seq_long_value; - TypeObjectUtils::add_union_case_label(label_seq_long_value, static_cast(2)); - MemberId member_id_long_value = 0x00000002; - bool common_long_value_ec {false}; - CommonUnionMember common_long_value {TypeObjectUtils::build_common_union_member(member_id_long_value, - member_flags_long_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MyUnion, - common_long_value_ec), label_seq_long_value)}; - if (!common_long_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union long_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_long_value = "long_value"; - eprosima::fastcdr::optional member_ann_builtin_long_value; - ann_custom_MyUnion.reset(); - CompleteMemberDetail detail_long_value = TypeObjectUtils::build_complete_member_detail(name_long_value, member_ann_builtin_long_value, ann_custom_MyUnion); - CompleteUnionMember member_long_value = TypeObjectUtils::build_complete_union_member(common_long_value, detail_long_value); - TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_long_value); - } - { - return_code_MyUnion = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "anonymous_string_unbounded", type_ids_MyUnion); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_MyUnion) - { - { - SBound bound = 0; - StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, - "anonymous_string_unbounded", type_ids_MyUnion)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); - } - } - } - UnionMemberFlag member_flags_string_value = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false); - UnionCaseLabelSeq label_seq_string_value; - TypeObjectUtils::add_union_case_label(label_seq_string_value, static_cast(3)); - MemberId member_id_string_value = 0x00000003; - bool common_string_value_ec {false}; - CommonUnionMember common_string_value {TypeObjectUtils::build_common_union_member(member_id_string_value, - member_flags_string_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MyUnion, - common_string_value_ec), label_seq_string_value)}; - if (!common_string_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union string_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_string_value = "string_value"; - eprosima::fastcdr::optional member_ann_builtin_string_value; - ann_custom_MyUnion.reset(); - CompleteMemberDetail detail_string_value = TypeObjectUtils::build_complete_member_detail(name_string_value, member_ann_builtin_string_value, ann_custom_MyUnion); - CompleteUnionMember member_string_value = TypeObjectUtils::build_complete_union_member(common_string_value, detail_string_value); - TypeObjectUtils::add_complete_union_member(member_seq_MyUnion, member_string_value); - } - CompleteUnionType union_type_MyUnion = TypeObjectUtils::build_complete_union_type(union_flags_MyUnion, header_MyUnion, discriminator_MyUnion, - member_seq_MyUnion); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_union_type_object(union_type_MyUnion, type_name_MyUnion.to_string(), type_ids_MyUnion)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "MyUnion already registered in TypeObjectRegistry for a different type."); - } - } -} -// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method -void register_union_struct_type_identifier( - TypeIdentifierPair& type_ids_union_struct) -{ - - ReturnCode_t return_code_union_struct {eprosima::fastdds::dds::RETCODE_OK}; - return_code_union_struct = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "union_struct", type_ids_union_struct); - if (eprosima::fastdds::dds::RETCODE_OK != return_code_union_struct) - { - StructTypeFlag struct_flags_union_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, - false, false); - QualifiedTypeName type_name_union_struct = "union_struct"; - eprosima::fastcdr::optional type_ann_builtin_union_struct; - eprosima::fastcdr::optional ann_custom_union_struct; - CompleteTypeDetail detail_union_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_union_struct, ann_custom_union_struct, type_name_union_struct.to_string()); - CompleteStructHeader header_union_struct; - header_union_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_union_struct); - CompleteStructMemberSeq member_seq_union_struct; - { - TypeIdentifierPair type_ids_index; - ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; - return_code_index = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "_uint32_t", type_ids_index); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); - return; - } - StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_index = 0x00000000; - bool common_index_ec {false}; - CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; - if (!common_index_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); - return; - } - MemberName name_index = "index"; - eprosima::fastcdr::optional member_ann_builtin_index; - ann_custom_union_struct.reset(); - CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_union_struct); - CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); - TypeObjectUtils::add_complete_struct_member(member_seq_union_struct, member_index); - } - { - TypeIdentifierPair type_ids_union_value; - ReturnCode_t return_code_union_value {eprosima::fastdds::dds::RETCODE_OK}; - return_code_union_value = - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( - "MyUnion", type_ids_union_value); - - if (eprosima::fastdds::dds::RETCODE_OK != return_code_union_value) - { - ::register_MyUnion_type_identifier(type_ids_union_value); - } - StructMemberFlag member_flags_union_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, - false, false, false, false); - MemberId member_id_union_value = 0x00000001; - bool common_union_value_ec {false}; - CommonStructMember common_union_value {TypeObjectUtils::build_common_struct_member(member_id_union_value, member_flags_union_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_union_value, common_union_value_ec))}; - if (!common_union_value_ec) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure union_value member TypeIdentifier inconsistent."); - return; - } - MemberName name_union_value = "union_value"; - eprosima::fastcdr::optional member_ann_builtin_union_value; - ann_custom_union_struct.reset(); - CompleteMemberDetail detail_union_value = TypeObjectUtils::build_complete_member_detail(name_union_value, member_ann_builtin_union_value, ann_custom_union_struct); - CompleteStructMember member_union_value = TypeObjectUtils::build_complete_struct_member(common_union_value, detail_union_value); - TypeObjectUtils::add_complete_struct_member(member_seq_union_struct, member_union_value); - } - CompleteStructType struct_type_union_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_union_struct, header_union_struct, member_seq_union_struct); - if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == - TypeObjectUtils::build_and_register_struct_type_object(struct_type_union_struct, type_name_union_struct.to_string(), type_ids_union_struct)) - { - EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, - "union_struct already registered in TypeObjectRegistry for a different type."); - } - } -} - diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp deleted file mode 100644 index 6949f933..00000000 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/union_structTypeObjectSupport.hpp +++ /dev/null @@ -1,68 +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 union_structTypeObjectSupport.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. - */ - -#ifndef FAST_DDS_GENERATED__UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__UNION_STRUCT_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 - -/** - * @brief Register MyUnion related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_MyUnion_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); -/** - * @brief Register union_struct related TypeIdentifier. - * Fully-descriptive TypeIdentifiers are directly registered. - * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is - * indirectly registered as well. - * - * @param[out] TypeIdentifier of the registered type. - * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. - * Invalid TypeIdentifier is returned in case of error. - */ -eProsima_user_DllExport void register_union_struct_type_identifier( - eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__UNION_STRUCT_TYPE_OBJECT_SUPPORT_HPP From 0ca4be65d98603363543f6a0d136ced0068553f1 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 16 Jul 2024 15:10:46 +0200 Subject: [PATCH 15/53] Delete public functions in PayloadPool inherited from IPayloadPool and add missing tests in CMake file Signed-off-by: Lucia Echevarria --- .../efficiency/payload/PayloadPool.hpp | 139 ------------------ .../cpp/efficiency/payload/PayloadPool.cpp | 59 -------- .../test/unittest/efficiency/CMakeLists.txt | 2 + 3 files changed, 2 insertions(+), 198 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp index 5c421262..0b51137f 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp @@ -50,145 +50,6 @@ class PayloadPool : public eprosima::fastdds::rtps::IPayloadPool DDSPIPE_CORE_DllAPI virtual ~PayloadPool(); - // ///// - // // FAST DDS PART - - // /** - // * @brief Reserve a new \c payload of max size \c size . - // * - // * This method calls \c get_payload for the serialized payload. - // * The \c payload owner is set to \c this . - // * - // * @warning length value in \c payload is not modified. - // * - // * @note This method may reserve new memory. - // * - // * @param [in] size : Size in bytes of the payload that will be reserved - // * @param [out] cache_change : the cache change which SerializedPayload will be set - // * - // * @return true if everything ok - // * @return false if something went wrong - // * - // */ - // DDSPIPE_CORE_DllAPI - // virtual bool get_payload( - // uint32_t size, - // eprosima::fastdds::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented - - // /** - // * @brief Assign to \c payload the \c data payload. - // * - // * This method should reuse \c data and not copy it in case the owner of \c data is \c this . - // * It sets values to the serialized \c payload . - // * - // * This method calls \c get_payload for the serialized payload. - // * The \c payload owner is set to \c this . - // * - // * @note This method may reserve new memory in case the owner is not \c this . - // * - // * @param [in,out] data Serialized payload received - // * @param [in,out] payload Cache change to assign the payload to - // * - // * - // * @return true if everything ok - // * @return false if something went wrong - // * - // */ - // DDSPIPE_CORE_DllAPI - // virtual bool get_payload( - // eprosima::fastdds::rtps::SerializedPayload_t& data, - // eprosima::fastdds::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented - - // /** - // * @brief Release the data from the serialized \c payload . - // * - // * @note This method must only release the actual memory of a data in case nobody is referencing it anymore. - // * - // * This method calls \c release_payload for the serialized payload. - // * The \c payload owner is set to \c nullptr . - // * - // * @param [in,out] payload to release - // * - // * @return true if everything ok - // * @return false if something went wrong - // * - // * @throw IncosistencyException if cache change owner is other than this - // */ - // DDSPIPE_CORE_DllAPI - // virtual bool release_payload( - // eprosima::fastdds::rtps::SerializedPayload_t& payload) override; // TODO add noexcept once is implemented - - // /// - // DDSPIPE PART - - // /** - // * @brief Reserve a new data in \c payload of size \c size. - // * - // * It sets value \c max_size and \c data of \c payload . - // * - // * @note This method may reserve new memory. - // * - // * @warning length value in \c payload is not modified. - // * - // * @param [in] size : Size in bytes of the payload that will be reserved - // * @param [out] payload : the SerializedPayload that will be set - // * - // * @return true if everything ok - // * @return false if something went wrong - // * - // * @pre Fields @c payload must not have been initialized. - // */ - // DDSPIPE_CORE_DllAPI - // virtual bool get_payload( - // uint32_t size, - // types::Payload& payload) = 0; - - // /** - // * @brief Store in \c target_payload the data from \c src_payload . - // * - // * This method set \c target_payload fields \c max_size , \c lenght and \c data . - // * This method "should" reuse data in \c src_payload and not copy it in case \c data_owner is \c this . - // * - // * @note This method may reserve new memory in case the owner is not \c this . - // * - // * @param [in] src_payload Payload to move to target - // * @param [in,out] data_owner Payload pool owning incoming data \c src_payload - // * @param [out] target_payload Payload to assign the payload to - // * - // * @warning @c data_owner can only be changed from @c nullptr to @c this. If a value different from - // * @c nullptr is received it must be left unchanged. - // * - // * @return true if everything ok - // * @return false if something went wrong - // * - // * @pre Fields @c target_payload must not have been initialized. - // */ - // DDSPIPE_CORE_DllAPI - // virtual bool get_payload( - // const types::Payload& src_payload, - // IPayloadPool*& data_owner, - // types::Payload& target_payload) = 0; - - // /** - // * @brief Release the data from the \c payload . - // * - // * @note This method must only release the actual memory of a data in case nobody is referencing it anymore. - // * - // * @note This method should use method \c reserve_ to reserve new memory. - // * - // * Reset the \c payload info. - // * - // * @param [in,out] payload Payload to release data from - // * - // * @return true if everything ok - // * @return false if something went wrong - // * - // * @pre @c payload must have been initialized from this pool. - // */ - // DDSPIPE_CORE_DllAPI - // virtual bool release_payload( - // types::Payload& payload) = 0; - //! Wether every payload get has been released. DDSPIPE_CORE_DllAPI virtual bool is_clean() const noexcept; diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index 4e6d7709..e49ba797 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -52,65 +52,6 @@ PayloadPool::~PayloadPool() } } -///// -// FAST DDS PART - -// bool PayloadPool::get_payload( -// uint32_t size, -// eprosima::fastdds::rtps::CacheChange_t& cache_change) -// { -// if (get_payload(size, cache_change.serializedPayload)) -// { -// cache_change.payload_owner(this); -// return true; -// } -// else -// { -// logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while creating payload.") -// return false; -// } -// } - -// bool PayloadPool::get_payload( -// fastdds::rtps::SerializedPayload_t& data, -// IPayloadPool*& data_owner, -// eprosima::fastdds::rtps::CacheChange_t& cache_change) -// { -// if (get_payload(data, data_owner, cache_change.serializedPayload)) -// { -// cache_change.payload_owner(this); -// return true; -// } -// else -// { -// logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while referencing payload.") -// return false; -// } -// } - -// bool PayloadPool::release_payload( -// fastdds::rtps::CacheChange_t& cache_change) -// { -// if (cache_change.payload_owner() == this) -// { -// if (release_payload(cache_change.serializedPayload)) -// { -// cache_change.payload_owner(nullptr); -// return true; -// } -// else -// { -// logDevError(DDSPIPE_PAYLOADPOOL, "Error occurred while releasing payload.") -// return false; -// } -// } -// else -// { -// logError(DDSPIPE_PAYLOADPOOL, "Trying to remove a cache change in an incorrect pool.") -// throw utils::InconsistencyException("Trying to remove a cache change in an incorrect pool."); -// } -// } - bool PayloadPool::is_clean() const noexcept { return reserve_count_ == release_count_; diff --git a/ddspipe_core/test/unittest/efficiency/CMakeLists.txt b/ddspipe_core/test/unittest/efficiency/CMakeLists.txt index e71bc729..18fea881 100644 --- a/ddspipe_core/test/unittest/efficiency/CMakeLists.txt +++ b/ddspipe_core/test/unittest/efficiency/CMakeLists.txt @@ -27,8 +27,10 @@ set(TEST_SOURCES set(TEST_LIST reserve + reserve_negative release reserve_and_release_counter + reserve_and_release_counter_negative is_clean ) From 0889756856cd2c75d87f239e17d8f8113d42eef5 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 29 Jul 2024 07:36:58 +0200 Subject: [PATCH 16/53] Apply suggested changes Signed-off-by: Lucia Echevarria --- .../ddspipe_core/logging/DdsLogConsumer.hpp | 5 +- .../consumers/impl/DdsMonitorConsumer.ipp | 4 +- .../consumers/impl/LogMonitorConsumer.ipp | 2 +- .../producers/StatusMonitorProducer.hpp | 1 - .../producers/TopicsMonitorProducer.hpp | 5 +- .../ddspipe_core/types/dds/DomainId.hpp | 1 - .../ddspipe_core/types/dds/Endpoint.hpp | 18 ++++---- .../ddspipe_core/types/dds/Payload.hpp | 20 ++++---- .../types/dds/SpecificEndpointQoS.hpp | 2 - .../ddspipe_core/types/dds/TopicQoS.hpp | 6 +-- .../src/cpp/communication/dds/DdsBridge.cpp | 4 +- .../src/cpp/communication/dds/Track.cpp | 8 ++-- .../src/cpp/communication/rpc/RpcBridge.cpp | 16 +++---- .../cpp/communication/rpc/ServiceRegistry.cpp | 2 +- .../cpp/configuration/RoutesConfiguration.cpp | 2 +- ddspipe_core/src/cpp/core/DdsPipe.cpp | 26 +++++------ .../src/cpp/dynamic/DiscoveryDatabase.cpp | 8 ++-- .../src/cpp/dynamic/ParticipantsDatabase.cpp | 2 +- .../efficiency/payload/CopyPayloadPool.cpp | 7 +-- .../efficiency/payload/FastPayloadPool.cpp | 13 +++--- .../cpp/efficiency/payload/MapPayloadPool.cpp | 4 +- .../cpp/efficiency/payload/PayloadPool.cpp | 4 +- ddspipe_core/src/cpp/monitoring/Monitor.cpp | 9 ++-- .../DdsMonitorParticipantRegistry.cpp | 6 +-- .../producers/StatusMonitorProducer.cpp | 20 ++++---- .../producers/TopicsMonitorProducer.cpp | 30 ++++++------ .../cpp/types/dynamic_types/schema_msg.cpp | 3 +- .../efficiency/FastPayloadPoolTest.cpp | 3 -- .../efficiency/MapPayloadPoolTest.cpp | 6 +-- .../test/unittest/logging/constants.hpp | 1 + .../dds_consumer/DdsLogConsumerTest.cpp | 24 +++++----- .../std_consumer/StdLogConsumerTest.cpp | 24 +++++----- .../dynamic_types/DynTypesParticipant.hpp | 3 +- .../rtps/InitialPeersParticipant.hpp | 3 +- .../reader/rtps/SimpleReader.hpp | 4 ++ .../writer/auxiliar/RtpsEchoWriter.hpp | 2 + .../writer/rtps/CommonWriter.hpp | 1 - .../participant/auxiliar/EchoParticipant.cpp | 2 +- .../cpp/participant/dds/CommonParticipant.cpp | 34 +++++++------- .../cpp/participant/dds/XmlParticipant.cpp | 4 +- .../dynamic_types/DynTypesParticipant.cpp | 18 ++++---- .../dynamic_types/SchemaParticipant.cpp | 2 +- .../participant/rtps/CommonParticipant.cpp | 46 +++++++++---------- .../rtps/DiscoveryServerParticipant.cpp | 15 +++--- .../rtps/InitialPeersParticipant.cpp | 4 +- .../src/cpp/reader/dds/CommonReader.cpp | 18 ++++---- .../src/cpp/reader/dds/SpecificQoSReader.cpp | 2 +- .../src/cpp/reader/rpc/SimpleReader.cpp | 2 +- .../src/cpp/reader/rtps/CommonReader.cpp | 23 +++++----- .../src/cpp/reader/rtps/SpecificQoSReader.cpp | 2 +- .../src/cpp/types/address/Address.cpp | 12 ++--- .../src/cpp/types/dds/TopicDataType.cpp | 2 +- .../types/security/tls/TlsConfiguration.cpp | 4 +- .../cpp/writer/auxiliar/RtpsEchoWriter.cpp | 1 + .../src/cpp/writer/dds/CommonWriter.cpp | 6 +-- .../src/cpp/writer/dds/MultiWriter.cpp | 2 +- .../cpp/writer/dynamic_types/SchemaWriter.cpp | 4 +- .../writer/dynamic_types/TypeObjectWriter.cpp | 2 +- .../src/cpp/writer/rpc/SimpleWriter.cpp | 2 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 16 ++++--- .../src/cpp/writer/rtps/MultiWriter.cpp | 2 +- ddspipe_yaml/src/cpp/YamlReader_types.cpp | 2 +- 62 files changed, 261 insertions(+), 265 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp b/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp index 610f14b2..13a1a703 100644 --- a/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp +++ b/ddspipe_core/include/ddspipe_core/logging/DdsLogConsumer.hpp @@ -21,14 +21,13 @@ #include #include -#include -#include - #include #include #include #include +#include +#include #include #include #include diff --git a/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/DdsMonitorConsumer.ipp b/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/DdsMonitorConsumer.ipp index 4c0f7b6d..00fab462 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/DdsMonitorConsumer.ipp +++ b/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/DdsMonitorConsumer.ipp @@ -68,7 +68,7 @@ DdsMonitorConsumer::DdsMonitorConsumer( participant_->guid() << " in topic " << topic_ << "."); } - logInfo(DDSPIPE_MONITOR, "MONITOR | Created DataWriter " << writer_ << " for Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Created DataWriter " << writer_ << " for Participant " << participant_->guid() << " in topic " << topic_ << "."); } @@ -95,7 +95,7 @@ template void DdsMonitorConsumer::consume( const T& data) const { - writer_->write(&const_cast(data)); + writer_->write(&data); } template diff --git a/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/LogMonitorConsumer.ipp b/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/LogMonitorConsumer.ipp index f9856dc5..8e0b0ac2 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/LogMonitorConsumer.ipp +++ b/ddspipe_core/include/ddspipe_core/monitoring/consumers/impl/LogMonitorConsumer.ipp @@ -25,7 +25,7 @@ template void LogMonitorConsumer::consume( const T& data) const { - logInfo(DDSPIPE_MONITOR, "MONITOR_DATA | " << data); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR_DATA | " << data); } template diff --git a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp index fa2e7230..fd419de3 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp +++ b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp @@ -22,7 +22,6 @@ #include #include #include - #include #include #include diff --git a/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp b/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp index fb396a91..733ca247 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp +++ b/ddspipe_core/include/ddspipe_core/monitoring/producers/TopicsMonitorProducer.hpp @@ -26,13 +26,10 @@ #include #include #include +#include #include #include -#include -#include -#include - // Macro to notify that a message has been received in a topic by a participant. #define monitor_msg_rx(topic, participant_id) MONITOR_MSG_RX_IMPL_(topic, participant_id) diff --git a/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp b/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp index 3d93179e..365c05de 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/DomainId.hpp @@ -15,7 +15,6 @@ #pragma once #include -#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp index 77c77b5d..10f80e0a 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp @@ -75,23 +75,23 @@ struct Endpoint bool operator ==( const Endpoint& other) const noexcept; - //! Kind of the endpoint - EndpointKind kind {EndpointKind::invalid}; + //! Whether the endpoint is currently active + bool active {true}; + + //! Id of participant who discovered this endpoint + ParticipantId discoverer_participant_id {DEFAULT_PARTICIPANT_ID}; //! Unique id of the endpoint Guid guid {}; - //! Topic that this endpoint belongs to - DdsTopic topic {}; + //! Kind of the endpoint + EndpointKind kind {EndpointKind::invalid}; //! Specific QoS of the entity SpecificEndpointQoS specific_qos {}; - //! Whether the endpoint is currently active - bool active {true}; - - //! Id of participant who discovered this endpoint - ParticipantId discoverer_participant_id {DEFAULT_PARTICIPANT_ID}; + //! Topic that this endpoint belongs to + DdsTopic topic {}; }; /** diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp index 66126b56..e891d47e 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp @@ -31,26 +31,26 @@ namespace ddspipe { namespace core { namespace types { -//! Durability kind enumeration -using PartitionQosPolicy = eprosima::fastdds::dds::PartitionQosPolicy; +//! Instance Handler type +using ChangeKind = eprosima::fastdds::rtps::ChangeKind_t; -//! Partition configuration -using OwnershipStrengthQosPolicy = eprosima::fastdds::dds::OwnershipStrengthQosPolicy; +//! Fast DDS Time +using DataTime = eprosima::fastdds::rtps::Time_t; //! Instance Handler type using InstanceHandle = eprosima::fastdds::rtps::InstanceHandle_t; -//! Instance Handler type -using ChangeKind = eprosima::fastdds::rtps::ChangeKind_t; +//! Ownership Strength configuration +using OwnershipStrengthQosPolicy = eprosima::fastdds::dds::OwnershipStrengthQosPolicy; -//! Fast DDS Time -using DataTime = eprosima::fastdds::rtps::Time_t; +//! Payload references the raw data received. +using Payload = eprosima::fastdds::rtps::SerializedPayload_t; //! Kind of every unit that creates a Payload using PayloadUnit = eprosima::fastdds::rtps::octet; -//! Payload references the raw data received. -using Payload = eprosima::fastdds::rtps::SerializedPayload_t; +//! Partition configuration +using PartitionQosPolicy = eprosima::fastdds::dds::PartitionQosPolicy; //! \c octet to stream serializator DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp b/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp index 483ecc94..bfa479d0 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/SpecificEndpointQoS.hpp @@ -15,8 +15,6 @@ #pragma once #include -#include -#include #include diff --git a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp index 1ff55ce9..44a7b813 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/TopicQoS.hpp @@ -29,15 +29,15 @@ namespace types { //! Durability kind enumeration using DurabilityKind = eprosima::fastdds::rtps::DurabilityKind_t; -//! Reliability kind enumeration -using ReliabilityKind = eprosima::fastdds::rtps::ReliabilityKind_t; - //! History kind enumeration using HistoryDepthType = unsigned int; //! Ownership configuration using OwnershipQosPolicyKind = eprosima::fastdds::dds::OwnershipQosPolicyKind; +//! Reliability kind enumeration +using ReliabilityKind = eprosima::fastdds::rtps::ReliabilityKind_t; + /** * The collection of QoS related to a Topic. * diff --git a/ddspipe_core/src/cpp/communication/dds/DdsBridge.cpp b/ddspipe_core/src/cpp/communication/dds/DdsBridge.cpp index 7625314d..d1247c95 100644 --- a/ddspipe_core/src/cpp/communication/dds/DdsBridge.cpp +++ b/ddspipe_core/src/cpp/communication/dds/DdsBridge.cpp @@ -67,7 +67,7 @@ void DdsBridge::enable() noexcept if (!enabled_) { - logInfo(DDSPIPE_DDSBRIDGE, "Enabling DdsBridge for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDSBRIDGE, "Enabling DdsBridge for topic " << topic_ << "."); // ATTENTION: reference needed or it would copy Track for (auto& track_it : tracks_) @@ -85,7 +85,7 @@ void DdsBridge::disable() noexcept if (enabled_) { - logInfo(DDSPIPE_DDSBRIDGE, "Disabling DdsBridge for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDSBRIDGE, "Disabling DdsBridge for topic " << topic_ << "."); // ATTENTION: reference needed or it would copy Track for (auto& track_it : tracks_) diff --git a/ddspipe_core/src/cpp/communication/dds/Track.cpp b/ddspipe_core/src/cpp/communication/dds/Track.cpp index db449327..24ebcdec 100644 --- a/ddspipe_core/src/cpp/communication/dds/Track.cpp +++ b/ddspipe_core/src/cpp/communication/dds/Track.cpp @@ -87,7 +87,7 @@ void Track::enable() noexcept if (!enabled_) { - logInfo(DDSPIPE_TRACK, + EPROSIMA_LOG_INFO(DDSPIPE_TRACK, "Enabling Track " << reader_participant_id_ << " for topic " << topic_->serialize() << "."); enabled_ = true; @@ -117,7 +117,7 @@ void Track::disable() noexcept if (enabled_) { - logInfo(DDSPIPE_TRACK, + EPROSIMA_LOG_INFO(DDSPIPE_TRACK, "Disabling Track " << reader_participant_id_ << " for topic " << topic_->serialize() << "."); @@ -242,7 +242,7 @@ void Track::transmit_() noexcept else if (ret != utils::ReturnCode::OK) { // Error reading data - logWarning(DDSPIPE_TRACK, "Error taking data in Track " << topic_->serialize() << ". Error code " << ret + EPROSIMA_LOG_WARNING(DDSPIPE_TRACK, "Error taking data in Track " << topic_->serialize() << ". Error code " << ret << ". Skipping data and continue."); continue; } @@ -262,7 +262,7 @@ void Track::transmit_() noexcept if (ret != utils::ReturnCode::OK) { - logWarning( + EPROSIMA_LOG_WARNING( DDSPIPE_TRACK, "Error writting data in Track " << topic_->serialize() << " for writer " << writer_it.second.get() diff --git a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp index 5d991d9e..e9659c0c 100644 --- a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp +++ b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp @@ -59,7 +59,7 @@ RpcBridge::~RpcBridge() void RpcBridge::init_nts_() { - logInfo(DDSPIPE_RPCBRIDGE, "Creating endpoints in RpcBridge for service " << rpc_topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_RPCBRIDGE, "Creating endpoints in RpcBridge for service " << rpc_topic_ << "."); // TODO: remove and use every participant std::set ids = participants_->get_rtps_participants_ids(); @@ -113,7 +113,7 @@ void RpcBridge::enable() noexcept if (!enabled_ && servers_available_()) { - logInfo(DDSPIPE_RPCBRIDGE, "Enabling RpcBridge for service " << rpc_topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_RPCBRIDGE, "Enabling RpcBridge for service " << rpc_topic_ << "."); if (!init_) { @@ -123,7 +123,7 @@ void RpcBridge::enable() noexcept } catch (const utils::InitializationException& e) { - logError(DDSPIPE_RPCBRIDGE, + EPROSIMA_LOG_ERROR(DDSPIPE_RPCBRIDGE, "Error while creating endpoints in RpcBridge for service " << rpc_topic_ << ". Error code:" << e.what() << "."); return; @@ -163,7 +163,7 @@ void RpcBridge::disable() noexcept if (enabled_) { - logInfo(DDSPIPE_RPCBRIDGE, "Disabling RpcBridge for service " << rpc_topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_RPCBRIDGE, "Disabling RpcBridge for service " << rpc_topic_ << "."); enabled_ = false; @@ -304,7 +304,7 @@ void RpcBridge::transmit_( if (ret != utils::ReturnCode::OK) { // Error reading data - logWarning(DDSPIPE_RPCBRIDGE, + EPROSIMA_LOG_WARNING(DDSPIPE_RPCBRIDGE, "Error taking data at service Reader in topic " << reader->topic() << ". Error code " << ret << ". Skipping data and continue."); @@ -323,7 +323,7 @@ void RpcBridge::transmit_( if (reply_related_sample_identity == SampleIdentity::unknown()) { - logWarning(DDSPIPE_RPCBRIDGE, + EPROSIMA_LOG_WARNING(DDSPIPE_RPCBRIDGE, "RpcBridge for service " << rpc_topic_ << " received ill-formed request from remote endpoint " << rpc_data.source_guid << ". Ignoring..."); @@ -353,7 +353,7 @@ void RpcBridge::transmit_( if (ret != utils::ReturnCode::OK) { - logWarning(DDSPIPE_RPCBRIDGE, "Error writting request in RpcBridge for service " + EPROSIMA_LOG_WARNING(DDSPIPE_RPCBRIDGE, "Error writting request in RpcBridge for service " << rpc_topic_ << ". Error code " << ret << ". Skipping data for this writer and continue."); continue; @@ -410,7 +410,7 @@ void RpcBridge::transmit_( if (ret != utils::ReturnCode::OK) { - logWarning(DDSPIPE_RPCBRIDGE, "Error writting reply in RpcBridge for service " + EPROSIMA_LOG_WARNING(DDSPIPE_RPCBRIDGE, "Error writting reply in RpcBridge for service " << rpc_topic_ << ". Error code " << ret << "."); } else diff --git a/ddspipe_core/src/cpp/communication/rpc/ServiceRegistry.cpp b/ddspipe_core/src/cpp/communication/rpc/ServiceRegistry.cpp index 1212d7ad..81f3a05f 100644 --- a/ddspipe_core/src/cpp/communication/rpc/ServiceRegistry.cpp +++ b/ddspipe_core/src/cpp/communication/rpc/ServiceRegistry.cpp @@ -68,7 +68,7 @@ void ServiceRegistry::add( if (registry_.count(idx)) { // Should never occur as each sequence number associated to a write operation is unique - logWarning(DDSPIPE_SERVICEREGISTRY, + EPROSIMA_LOG_WARNING(DDSPIPE_SERVICEREGISTRY, "ServiceRegistry for service " << topic_ << " in participant " << participant_id_ << " attempting to add entry with already present SequenceNumber."); return; diff --git a/ddspipe_core/src/cpp/configuration/RoutesConfiguration.cpp b/ddspipe_core/src/cpp/configuration/RoutesConfiguration.cpp index c9ee187c..59dae06e 100644 --- a/ddspipe_core/src/cpp/configuration/RoutesConfiguration.cpp +++ b/ddspipe_core/src/cpp/configuration/RoutesConfiguration.cpp @@ -87,7 +87,7 @@ bool RoutesConfiguration::is_valid( if (!src_in_dst && is_repeater) { // Warn the user repeater routes must be set manually - logWarning( + EPROSIMA_LOG_WARNING( DDSPIPE_ROUTES, "Source not found in destinations for repeater participant " << src_id << ". If willing to send data through this participant, add its name to the destinations (dst) list."); diff --git a/ddspipe_core/src/cpp/core/DdsPipe.cpp b/ddspipe_core/src/cpp/core/DdsPipe.cpp index 4b63152b..b00a6792 100644 --- a/ddspipe_core/src/cpp/core/DdsPipe.cpp +++ b/ddspipe_core/src/cpp/core/DdsPipe.cpp @@ -140,7 +140,7 @@ utils::ReturnCode DdsPipe::enable() noexcept { enabled_ = true; - logInfo(DDSPIPE, "Enabling DDS Pipe."); + EPROSIMA_LOG_INFO(DDSPIPE, "Enabling DDS Pipe."); activate_all_topics_nts_(); @@ -158,7 +158,7 @@ utils::ReturnCode DdsPipe::enable() noexcept } else { - logInfo(DDSPIPE, "Trying to enable an already enabled DDS Pipe."); + EPROSIMA_LOG_INFO(DDSPIPE, "Trying to enable an already enabled DDS Pipe."); return utils::ReturnCode::PRECONDITION_NOT_MET; } } @@ -171,7 +171,7 @@ utils::ReturnCode DdsPipe::disable() noexcept { enabled_ = false; - logInfo(DDSPIPE, "Disabling DDS Pipe."); + EPROSIMA_LOG_INFO(DDSPIPE, "Disabling DDS Pipe."); deactivate_all_topics_nts_(); @@ -179,7 +179,7 @@ utils::ReturnCode DdsPipe::disable() noexcept } else { - logInfo(DDSPIPE, "Trying to disable a disabled DDS Pipe."); + EPROSIMA_LOG_INFO(DDSPIPE, "Trying to disable a disabled DDS Pipe."); return utils::ReturnCode::PRECONDITION_NOT_MET; } } @@ -190,7 +190,7 @@ void DdsPipe::init_allowed_topics_() configuration_.allowlist, configuration_.blocklist); - logInfo(DDSROUTER, "DDS Router configured with allowed topics: " << *allowed_topics_); + EPROSIMA_LOG_INFO(DDSROUTER, "DDS Router configured with allowed topics: " << *allowed_topics_); } utils::ReturnCode DdsPipe::reload_allowed_topics_( @@ -415,7 +415,7 @@ void DdsPipe::init_bridges_nts_( void DdsPipe::discovered_topic_nts_( const utils::Heritable& topic) noexcept { - logInfo(DDSPIPE, "Discovered topic: " << topic << " by: " << topic->topic_discoverer() << "."); + EPROSIMA_LOG_INFO(DDSPIPE, "Discovered topic: " << topic << " by: " << topic->topic_discoverer() << "."); // Check if the bridge (and the topic) already exist. auto it_bridge = bridges_.find(topic); @@ -443,7 +443,7 @@ void DdsPipe::discovered_service_nts_( const ParticipantId& server_participant_id, const GuidPrefix& server_guid_prefix) noexcept { - logInfo(DDSPIPE, "Discovered service: " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE, "Discovered service: " << topic << "."); auto it_bridge = rpc_bridges_.find(topic); @@ -474,7 +474,7 @@ void DdsPipe::removed_service_nts_( const ParticipantId& server_participant_id, const GuidPrefix& server_guid_prefix) noexcept { - logInfo(DDSPIPE, "Removed service: " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE, "Removed service: " << topic << "."); auto it_bridge = rpc_bridges_.find(topic); @@ -488,7 +488,7 @@ void DdsPipe::create_new_bridge_nts_( const utils::Heritable& topic, bool enabled /*= false*/) noexcept { - logInfo(DDSPIPE, "Creating Bridge for topic: " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE, "Creating Bridge for topic: " << topic << "."); try { @@ -513,7 +513,7 @@ void DdsPipe::create_new_bridge_nts_( } catch (const utils::InitializationException& e) { - logError(DDSPIPE, + EPROSIMA_LOG_ERROR(DDSPIPE, "Error creating Bridge for topic " << topic << ". Error code:" << e.what() << "."); } @@ -522,7 +522,7 @@ void DdsPipe::create_new_bridge_nts_( void DdsPipe::create_new_service_nts_( const RpcTopic& topic) noexcept { - logInfo(DDSPIPE, "Creating Service: " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE, "Creating Service: " << topic << "."); // Endpoints not created until enabled for the first time, so no exception can be thrown rpc_bridges_[topic] = std::make_unique(topic, participants_database_, payload_pool_, thread_pool_); @@ -531,7 +531,7 @@ void DdsPipe::create_new_service_nts_( void DdsPipe::activate_topic_nts_( const utils::Heritable& topic) noexcept { - logInfo(DDSPIPE, "Activating topic: " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE, "Activating topic: " << topic << "."); // Modify current_topics_ and set this topic as active current_topics_[topic] = true; @@ -554,7 +554,7 @@ void DdsPipe::activate_topic_nts_( void DdsPipe::deactivate_topic_nts_( const utils::Heritable& topic) noexcept { - logInfo(DDSPIPE, "Deactivating topic: " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE, "Deactivating topic: " << topic << "."); // Modify current_topics_ and set this topic as not active current_topics_[topic] = false; diff --git a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp index 67c0d6a6..a1823f49 100644 --- a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp +++ b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp @@ -123,7 +123,7 @@ bool DiscoveryDatabase::add_endpoint_( // If exists but inactive, modify entry it->second = new_endpoint; - logInfo(DDSPIPE_DISCOVERY_DATABASE, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY_DATABASE, "Modifying an already discovered (inactive) Endpoint " << new_endpoint << "."); return true; @@ -131,7 +131,7 @@ bool DiscoveryDatabase::add_endpoint_( } else { - logInfo(DDSPIPE_DISCOVERY_DATABASE, "Inserting a new discovered Endpoint " << new_endpoint << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY_DATABASE, "Inserting a new discovered Endpoint " << new_endpoint << "."); // Add it to the dictionary entities_.insert(std::pair(new_endpoint.guid, new_endpoint)); @@ -163,7 +163,7 @@ bool DiscoveryDatabase::update_endpoint_( } else { - logInfo(DDSPIPE_DISCOVERY_DATABASE, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY_DATABASE, "Modifying an already discovered Endpoint " << endpoint_to_update << "."); // Modify entry @@ -187,7 +187,7 @@ utils::ReturnCode DiscoveryDatabase::erase_endpoint_( { std::unique_lock lock(mutex_); - logInfo(DDSPIPE_DISCOVERY_DATABASE, "Erasing Endpoint " << endpoint_to_erase << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY_DATABASE, "Erasing Endpoint " << endpoint_to_erase << "."); auto erased = entities_.erase(endpoint_to_erase.guid); diff --git a/ddspipe_core/src/cpp/dynamic/ParticipantsDatabase.cpp b/ddspipe_core/src/cpp/dynamic/ParticipantsDatabase.cpp index 633c5944..4ec947b2 100644 --- a/ddspipe_core/src/cpp/dynamic/ParticipantsDatabase.cpp +++ b/ddspipe_core/src/cpp/dynamic/ParticipantsDatabase.cpp @@ -117,7 +117,7 @@ void ParticipantsDatabase::add_participant( } else { - logInfo(DDSPIPE_PARTICIPANT_DATABASE, "Inserting a new Participant " << id); + EPROSIMA_LOG_INFO(DDSPIPE_PARTICIPANT_DATABASE, "Inserting a new Participant " << id); } participants_[id] = participant; diff --git a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp index b8052035..142d2bd3 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp @@ -24,11 +24,12 @@ namespace eprosima { namespace ddspipe { namespace core { +using namespace eprosima::fastdds::rtps; using namespace eprosima::ddspipe::core::types; bool CopyPayloadPool::get_payload( uint32_t size, - eprosima::fastdds::rtps::SerializedPayload_t& payload) + SerializedPayload_t& payload) { reserve_(size, payload); payload.max_size = size; @@ -38,8 +39,8 @@ bool CopyPayloadPool::get_payload( } bool CopyPayloadPool::get_payload( - const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, - eprosima::fastdds::rtps::SerializedPayload_t& target_payload) + const SerializedPayload_t& src_payload, + SerializedPayload_t& target_payload) { if (!get_payload(src_payload.max_size, target_payload)) { diff --git a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp index 65b1cad1..faf5ac22 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp @@ -27,19 +27,20 @@ namespace eprosima { namespace ddspipe { namespace core { +using namespace eprosima::fastdds::rtps; using namespace eprosima::ddspipe::core::types; bool FastPayloadPool::get_payload( uint32_t size, - eprosima::fastdds::rtps::SerializedPayload_t& payload) + SerializedPayload_t& payload) { // Reserve new payload return reserve_(size, payload); } bool FastPayloadPool::get_payload( - const eprosima::fastdds::rtps::SerializedPayload_t& src_payload, - eprosima::fastdds::rtps::SerializedPayload_t& target_payload) + const SerializedPayload_t& src_payload, + SerializedPayload_t& target_payload) { // If we are not the owner, create a new payload. Else, reference the existing one if (src_payload.payload_owner != this) @@ -109,7 +110,7 @@ bool FastPayloadPool::release_payload( bool FastPayloadPool::reserve_( uint32_t size, - eprosima::fastdds::rtps::SerializedPayload_t& payload) + SerializedPayload_t& payload) { if (size == 0) { @@ -125,7 +126,7 @@ bool FastPayloadPool::reserve_( MetaInfoType* reference_place = reinterpret_cast(memory_allocated); (*reference_place) = 1; - payload.data = reinterpret_cast(reference_place + 1); + payload.data = reinterpret_cast(reference_place + 1); payload.max_size = size; payload.payload_owner = this; @@ -137,7 +138,7 @@ bool FastPayloadPool::reserve_( } bool FastPayloadPool::release_( - eprosima::fastdds::rtps::SerializedPayload_t& payload) + SerializedPayload_t& payload) { logDebug(DDSPIPE_PAYLOADPOOL_FAST, "Releasing payload ptr: " << static_cast(payload.data) << "."); diff --git a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp index 78c75c8c..c401e35b 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp @@ -85,7 +85,7 @@ bool MapPayloadPool::get_payload( auto payload_it = reserved_payloads_.find(src_payload.data); if (payload_it == reserved_payloads_.end()) { - logError(DDSPIPE_PAYLOADPOOL, "Payload ownership is this pool, but it is not reserved from here."); + EPROSIMA_LOG_ERROR(DDSPIPE_PAYLOADPOOL, "Payload ownership is this pool, but it is not reserved from here."); throw utils::InconsistencyException("Payload ownership is this pool, but it is not reserved from here."); } @@ -110,7 +110,7 @@ bool MapPayloadPool::release_payload( auto payload_it = reserved_payloads_.find(payload.data); if (payload_it == reserved_payloads_.end()) { - logError(DDSPIPE_PAYLOADPOOL, "Trying to release a payload from this pool that is not present."); + EPROSIMA_LOG_ERROR(DDSPIPE_PAYLOADPOOL, "Trying to release a payload from this pool that is not present."); throw utils::InconsistencyException("Trying to release a payload from this pool that is not present."); } diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index e49ba797..d3e7f08c 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -47,7 +47,7 @@ PayloadPool::~PayloadPool() } else { - logInfo(DDSPIPE_PAYLOADPOOL, + EPROSIMA_LOG_INFO(DDSPIPE_PAYLOADPOOL, "Removing PayloadPool correctly after reserve: " << reserve_count_ << " payloads."); } } @@ -70,7 +70,7 @@ void PayloadPool::add_release_payload_() ++release_count_; if (release_count_ > reserve_count_) { - logError(DDSPIPE_PAYLOADPOOL, + EPROSIMA_LOG_ERROR(DDSPIPE_PAYLOADPOOL, "Inconsistent PayloadPool, releasing more payloads than reserved."); throw utils::InconsistencyException("Inconsistent PayloadPool, releasing more payloads than reserved."); } diff --git a/ddspipe_core/src/cpp/monitoring/Monitor.cpp b/ddspipe_core/src/cpp/monitoring/Monitor.cpp index 47ccb02a..ed9ad660 100644 --- a/ddspipe_core/src/cpp/monitoring/Monitor.cpp +++ b/ddspipe_core/src/cpp/monitoring/Monitor.cpp @@ -16,12 +16,11 @@ #include -#include #include #include +#include #include #include - #include #include #include @@ -53,7 +52,7 @@ Monitor::~Monitor() void Monitor::monitor_status() { - logInfo(DDSPIPE_MONITOR, "MONITOR | Registering Status Monitor Producer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Registering Status Monitor Producer."); // Register the Status Monitor Producer auto status_producer = ddspipe::core::StatusMonitorProducer::get_instance(); @@ -76,7 +75,7 @@ void Monitor::monitor_status() void Monitor::monitor_topics() { - logInfo(DDSPIPE_MONITOR, "MONITOR | Registering Topics Monitor Producer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Registering Topics Monitor Producer."); // Register the Topics Monitor Producer auto topics_producer = ddspipe::core::TopicsMonitorProducer::get_instance(); @@ -100,7 +99,7 @@ void Monitor::monitor_topics() void Monitor::register_producer_( IMonitorProducer* producer) { - logInfo(DDSPIPE_MONITOR, "MONITOR | Registering producer " << producer << "."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Registering producer " << producer << "."); producers_.push_back(producer); diff --git a/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp b/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp index 6886e69b..28288d2f 100644 --- a/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp +++ b/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp @@ -36,7 +36,7 @@ DdsMonitorParticipantRegistry::~DdsMonitorParticipantRegistry() continue; } - logInfo(DDSPIPE_MONITOR, + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Deleting Participant " << participant.second << " on domain " << participant.first << "."); participant.second->delete_contained_entities(); @@ -58,7 +58,7 @@ fastdds::dds::DomainParticipant* DdsMonitorParticipantRegistry::get_participant( // The participant already exists. Use it. participant = participants_[domain]; - logInfo(DDSPIPE_MONITOR, "MONITOR | Reusing Participant " << participant << " on domain " << domain << ".") + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Reusing Participant " << participant << " on domain " << domain << "."); } else { @@ -68,7 +68,7 @@ fastdds::dds::DomainParticipant* DdsMonitorParticipantRegistry::get_participant( participant = fastdds::dds::DomainParticipantFactory::get_instance()->create_participant(domain, pqos); - logInfo(DDSPIPE_MONITOR, "MONITOR | Created Participant " << participant << " on domain " << domain << "."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Created Participant " << participant << " on domain " << domain << "."); if (participant == nullptr) { diff --git a/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp b/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp index b6ae6c14..732dca70 100644 --- a/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp +++ b/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp @@ -32,7 +32,7 @@ void StatusMonitorProducer::init_instance( if (instance_ != nullptr) { - logWarning(DDSPIPE_MONITOR, "MONITOR | StatusMonitorProducer instance is already initialized."); + EPROSIMA_LOG_WARNING(DDSPIPE_MONITOR, "MONITOR | StatusMonitorProducer instance is already initialized."); return; } @@ -55,7 +55,7 @@ void StatusMonitorProducer::enable() { std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Enabling StatusMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Enabling StatusMonitorProducer."); enabled_ = true; } @@ -64,7 +64,7 @@ void StatusMonitorProducer::disable() { std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Disabling StatusMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Disabling StatusMonitorProducer."); enabled_ = false; } @@ -74,7 +74,7 @@ void StatusMonitorProducer::register_consumer( { if (!enabled_) { - logWarning(DDSPIPE_MONITOR, + EPROSIMA_LOG_WARNING(DDSPIPE_MONITOR, "MONITOR | Not registering consumer " << consumer->get_name() << " on StatusMonitorProducer" "since the StatusMonitorProducer is disabled."); @@ -83,7 +83,7 @@ void StatusMonitorProducer::register_consumer( std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Registering consumer " << consumer->get_name() << " on StatusMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Registering consumer " << consumer->get_name() << " on StatusMonitorProducer."); consumers_.push_back(std::move(consumer)); } @@ -92,7 +92,7 @@ void StatusMonitorProducer::clear_consumers() { std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Removing consumers from StatusMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Removing consumers from StatusMonitorProducer."); consumers_.clear(); } @@ -147,7 +147,7 @@ void StatusMonitorProducer::clear_data() { std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Clearing StatusMonitorProducer data."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Clearing StatusMonitorProducer data."); error_status_.type_mismatch(false); error_status_.qos_mismatch(false); @@ -171,7 +171,7 @@ void StatusMonitorProducer::add_error_to_status( // 2. Simultaneous calls to add_error_to_status. std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Adding error " << error << " to status."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Adding error " << error << " to status."); if (error == "TYPE_MISMATCH") { @@ -187,7 +187,7 @@ void StatusMonitorProducer::add_error_to_status( void StatusMonitorProducer::produce_nts_() { - logInfo(DDSPIPE_MONITOR, "MONITOR | Producing MonitoringStatus."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Producing MonitoringStatus."); data_.error_status(error_status_); data_.has_errors(has_errors_); @@ -195,7 +195,7 @@ void StatusMonitorProducer::produce_nts_() void StatusMonitorProducer::consume_nts_() { - logInfo(DDSPIPE_MONITOR, "MONITOR | Consuming MonitoringStatus.") + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Consuming MonitoringStatus."); for (auto& consumer : consumers_) { diff --git a/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp b/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp index b9455de1..6316a02d 100644 --- a/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp +++ b/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp @@ -30,7 +30,7 @@ void TopicsMonitorProducer::init_instance( if (instance_ != nullptr) { - logWarning(DDSPIPE_MONITOR, "MONITOR | TopicsMonitorProducer instance is already initialized."); + EPROSIMA_LOG_WARNING(DDSPIPE_MONITOR, "MONITOR | TopicsMonitorProducer instance is already initialized."); return; } @@ -53,7 +53,7 @@ void TopicsMonitorProducer::enable() { std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Enabling TopicsMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Enabling TopicsMonitorProducer."); enabled_ = true; } @@ -62,7 +62,7 @@ void TopicsMonitorProducer::disable() { std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Disabling TopicsMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Disabling TopicsMonitorProducer."); enabled_ = false; } @@ -72,7 +72,7 @@ void TopicsMonitorProducer::register_consumer( { if (!enabled_) { - logWarning(DDSPIPE_MONITOR, + EPROSIMA_LOG_WARNING(DDSPIPE_MONITOR, "MONITOR | Not registering consumer " << consumer->get_name() << " on TopicsMonitorProducer" "since the TopicsMonitorProducer is disabled."); @@ -81,7 +81,7 @@ void TopicsMonitorProducer::register_consumer( std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Registering consumer " << consumer->get_name() << " on TopicsMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Registering consumer " << consumer->get_name() << " on TopicsMonitorProducer."); consumers_.push_back(std::move(consumer)); } @@ -90,7 +90,7 @@ void TopicsMonitorProducer::clear_consumers() { std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Removing all consumers from TopicsMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Removing all consumers from TopicsMonitorProducer."); consumers_.clear(); } @@ -142,7 +142,7 @@ void TopicsMonitorProducer::clear_data() // Take the lock to prevent clearing the data while it's being saved std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Clearing the data."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Clearing the data."); topic_data_.clear(); participant_data_.clear(); @@ -167,7 +167,7 @@ void TopicsMonitorProducer::msgs_received( // 2. Simultaneous calls to msg_received. std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Received " << number_of_messages << " messages from Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Received " << number_of_messages << " messages from Participant " << participant_id << " on Topic " << topic << "."); // Register the topic @@ -198,7 +198,7 @@ void TopicsMonitorProducer::msgs_lost( // 2. Simultaneous calls to msg_lost. std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Lost " << number_of_messages << " messages from Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Lost " << number_of_messages << " messages from Participant " << participant_id << " on Topic " << topic << "."); // Register the topic @@ -227,7 +227,7 @@ void TopicsMonitorProducer::type_discovered( // 2. Simultaneous calls to msg_lost. std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Discovered type " << type_name << "."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Discovered type " << type_name << "."); types_discovered_[type_name] = true; } @@ -246,7 +246,7 @@ void TopicsMonitorProducer::type_mismatch( // 2. Simultaneous calls to msg_lost. std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | Type mismatch on Topic " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Type mismatch on Topic " << topic << "."); // Register the topic topic_data_[topic].name(topic.m_topic_name); @@ -270,7 +270,7 @@ void TopicsMonitorProducer::qos_mismatch( // 2. Simultaneous calls to msg_lost. std::lock_guard lock(mutex_); - logInfo(DDSPIPE_MONITOR, "MONITOR | QoS mismatch on Topic " << topic << "."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | QoS mismatch on Topic " << topic << "."); // Register the topic topic_data_[topic].name(topic.m_topic_name); @@ -282,7 +282,7 @@ void TopicsMonitorProducer::qos_mismatch( void TopicsMonitorProducer::produce_nts_() { - logInfo(DDSPIPE_MONITOR, "MONITOR | Producing MonitoringTopics."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Producing MonitoringTopics."); std::vector topics_data; @@ -317,7 +317,7 @@ void TopicsMonitorProducer::produce_nts_() void TopicsMonitorProducer::consume_nts_() { - logInfo(DDSPIPE_MONITOR, "MONITOR | Consuming MonitoringTopics."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Consuming MonitoringTopics."); for (auto& consumer : consumers_) { @@ -329,7 +329,7 @@ void TopicsMonitorProducer::consume_nts_() void TopicsMonitorProducer::reset_data_() { - logInfo(DDSPIPE_MONITOR, "MONITOR | Resetting the messages received and lost for the next period."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Resetting the messages received and lost for the next period."); // Reset the data for (auto& topic : participant_data_) diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index 5795b073..5c0c1f87 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -75,7 +76,7 @@ fastdds::dds::DynamicType::_ref_type container_internal_type( return type_descriptor->element_type(); } -std::vector array_size( +fastdds::dds::BoundSeq array_size( const fastdds::dds::DynamicType::_ref_type& dyn_type) { fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; diff --git a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp index 168fbacf..4e14ed8d 100644 --- a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp @@ -255,7 +255,6 @@ TEST(FastPayloadPoolTest, get_payload_from_src_negative) { eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockFastPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockFastPayloadPool* pool_ = static_cast(pool); - eprosima::fastdds::rtps::IPayloadPool* pool_aux = nullptr; // nullptr Payload payload_src; Payload payload_target; @@ -393,8 +392,6 @@ TEST(FastPayloadPoolTest, concurrent_release) ASSERT_TRUE(pool.get_payload(DEFAULT_SIZE, payload)); - eprosima::fastdds::rtps::IPayloadPool* payload_owner = - static_cast(&pool); Payload dst_payload; ASSERT_TRUE(pool.get_payload(payload, dst_payload)); diff --git a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp index 3739b0ee..10d4dd0a 100644 --- a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp @@ -51,15 +51,15 @@ class MockMapPayloadPool : public MapPayloadPool } uint64_t reference_count( - const eprosima::fastdds::rtps::SerializedPayload_t& payload) + const fastdds::rtps::SerializedPayload_t& payload) { return reserved_payloads_[payload.data]; } void clean_all( - std::vector& payloads) + std::vector& payloads) { - for (eprosima::fastdds::rtps::SerializedPayload_t& payload : payloads) + for (fastdds::rtps::SerializedPayload_t& payload : payloads) { release_payload(payload); } diff --git a/ddspipe_core/test/unittest/logging/constants.hpp b/ddspipe_core/test/unittest/logging/constants.hpp index 512427df..71f65036 100644 --- a/ddspipe_core/test/unittest/logging/constants.hpp +++ b/ddspipe_core/test/unittest/logging/constants.hpp @@ -23,6 +23,7 @@ #include #include + #include #include diff --git a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp index cd918482..9cd2b3dd 100644 --- a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp +++ b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp @@ -97,9 +97,9 @@ class DdsLogConsumerTest : public testing::Test * Test that the DdsLogConsumer publishes logs when publish::enable is set to true. * * CASES: - * - check that the DdsLogConsumer publishes logInfos. - * - check that the DdsLogConsumer publishes logWarnings. - * - check that the DdsLogConsumer publishes logErrors. + * - check that the DdsLogConsumer publishes EPROSIMA_LOG_INFOs. + * - check that the DdsLogConsumer publishes EPROSIMA_LOG_WARNINGs. + * - check that the DdsLogConsumer publishes EPROSIMA_LOG_ERRORs. */ TEST_F(DdsLogConsumerTest, publish_logs) { @@ -132,7 +132,7 @@ TEST_F(DdsLogConsumerTest, publish_logs) // INFO { - logInfo(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_INFO(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); utils::Log::Flush(); // Wait for the subscriber to receive the message @@ -150,7 +150,7 @@ TEST_F(DdsLogConsumerTest, publish_logs) // WARNING { - logWarning(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_WARNING(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); utils::Log::Flush(); // Wait for the subscriber to receive the message @@ -168,7 +168,7 @@ TEST_F(DdsLogConsumerTest, publish_logs) // ERROR { - logError(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_ERROR(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); utils::Log::Flush(); // Wait for the subscriber to receive the message @@ -191,9 +191,9 @@ TEST_F(DdsLogConsumerTest, publish_logs) * Test that the DdsLogConsumer doesn't publish when publish::enable is set to false. * * CASES: - * - check that the DdsLogConsumer doesn't publish logInfos. - * - check that the DdsLogConsumer doesn't publish logWarnings. - * - check that the DdsLogConsumer doesn't publish logErrors. + * - check that the DdsLogConsumer doesn't publish EPROSIMA_LOG_INFOs. + * - check that the DdsLogConsumer doesn't publish EPROSIMA_LOG_WARNINGs. + * - check that the DdsLogConsumer doesn't publish EPROSIMA_LOG_ERRORs. */ TEST_F(DdsLogConsumerTest, dont_publish_logs) { @@ -226,7 +226,7 @@ TEST_F(DdsLogConsumerTest, dont_publish_logs) // INFO { - logInfo(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_INFO(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); utils::Log::Flush(); // Wait for the subscriber to receive the message @@ -238,7 +238,7 @@ TEST_F(DdsLogConsumerTest, dont_publish_logs) // WARNING { - logWarning(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_WARNING(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); utils::Log::Flush(); // Wait for the subscriber to receive the message @@ -250,7 +250,7 @@ TEST_F(DdsLogConsumerTest, dont_publish_logs) // ERROR { - logError(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_ERROR(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); utils::Log::Flush(); // Wait for the subscriber to receive the message diff --git a/ddspipe_core/test/unittest/logging/std_consumer/StdLogConsumerTest.cpp b/ddspipe_core/test/unittest/logging/std_consumer/StdLogConsumerTest.cpp index d3d9f2d3..2f37df93 100644 --- a/ddspipe_core/test/unittest/logging/std_consumer/StdLogConsumerTest.cpp +++ b/ddspipe_core/test/unittest/logging/std_consumer/StdLogConsumerTest.cpp @@ -30,9 +30,9 @@ using namespace eprosima::fastdds::dds; * Test that the StdLogConsumer prints logs when stdout is set to true. * * CASES: - * - check that the StdLogConsumer prints logInfos. - * - check that the StdLogConsumer prints logWarnings. - * - check that the StdLogConsumer prints logErrors. + * - check that the StdLogConsumer prints EPROSIMA_LOG_INFOs. + * - check that the StdLogConsumer prints EPROSIMA_LOG_WARNINGs. + * - check that the StdLogConsumer prints EPROSIMA_LOG_ERRORs. */ TEST(StdLogConsumerTest, print_logs) { @@ -59,7 +59,7 @@ TEST(StdLogConsumerTest, print_logs) { testing::internal::CaptureStdout(); - logInfo(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_INFO(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); eprosima::utils::Log::Flush(); ASSERT_FALSE(testing::internal::GetCapturedStdout().empty()); @@ -69,7 +69,7 @@ TEST(StdLogConsumerTest, print_logs) { testing::internal::CaptureStderr(); - logWarning(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_WARNING(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); eprosima::utils::Log::Flush(); ASSERT_FALSE(testing::internal::GetCapturedStderr().empty()); @@ -79,7 +79,7 @@ TEST(StdLogConsumerTest, print_logs) { testing::internal::CaptureStderr(); - logError(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_ERROR(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); eprosima::utils::Log::Flush(); ASSERT_FALSE(testing::internal::GetCapturedStderr().empty()); @@ -90,9 +90,9 @@ TEST(StdLogConsumerTest, print_logs) * Test that the StdLogConsumer doesn't print logs when stdout is set to false. * * CASES: - * - check that the StdLogConsumer doesn't print logInfos. - * - check that the StdLogConsumer doesn't print logWarnings. - * - check that the StdLogConsumer doesn't print logErrors. + * - check that the StdLogConsumer doesn't print EPROSIMA_LOG_INFOs. + * - check that the StdLogConsumer doesn't print EPROSIMA_LOG_WARNINGs. + * - check that the StdLogConsumer doesn't print EPROSIMA_LOG_ERRORs. */ TEST(StdLogConsumerTest, dont_print_logs) { @@ -119,7 +119,7 @@ TEST(StdLogConsumerTest, dont_print_logs) { testing::internal::CaptureStdout(); - logInfo(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_INFO(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); eprosima::utils::Log::Flush(); ASSERT_TRUE(testing::internal::GetCapturedStdout().empty()); @@ -129,7 +129,7 @@ TEST(StdLogConsumerTest, dont_print_logs) { testing::internal::CaptureStderr(); - logWarning(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_WARNING(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); eprosima::utils::Log::Flush(); ASSERT_TRUE(testing::internal::GetCapturedStderr().empty()); @@ -139,7 +139,7 @@ TEST(StdLogConsumerTest, dont_print_logs) { testing::internal::CaptureStderr(); - logError(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); + EPROSIMA_LOG_ERROR(DDSPIPE_TEST, "LOG_CONSUMER_TEST | You only live once."); eprosima::utils::Log::Flush(); ASSERT_TRUE(testing::internal::GetCapturedStderr().empty()); diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index ead6fbea..2d1f09e0 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -39,9 +39,8 @@ namespace ddspipe { namespace participants { /** - * Simple RTPS Participant + * Simple RTPS Participant responsible for registering discovered types * - * TODO: separate these 2 participants */ class DynTypesParticipant : public rtps::SimpleParticipant { diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp index e5303964..0b11d86b 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp @@ -17,9 +17,8 @@ #include #include -#include - #include +#include namespace eprosima { namespace ddspipe { diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp index 03f4d66f..a7fe7d1c 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/SimpleReader.hpp @@ -14,8 +14,12 @@ #pragma once +#include +#include +#include #include #include +#include namespace eprosima { namespace ddspipe { diff --git a/ddspipe_participants/include/ddspipe_participants/writer/auxiliar/RtpsEchoWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/auxiliar/RtpsEchoWriter.hpp index 87a9d17e..79b45e77 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/auxiliar/RtpsEchoWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/auxiliar/RtpsEchoWriter.hpp @@ -16,6 +16,8 @@ #include +#include + #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index 4aba6baf..402d662d 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -38,7 +38,6 @@ #include #include -#include #include ///// diff --git a/ddspipe_participants/src/cpp/participant/auxiliar/EchoParticipant.cpp b/ddspipe_participants/src/cpp/participant/auxiliar/EchoParticipant.cpp index 095ebc76..622930b0 100644 --- a/ddspipe_participants/src/cpp/participant/auxiliar/EchoParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/auxiliar/EchoParticipant.cpp @@ -94,7 +94,7 @@ std::shared_ptr EchoParticipant::create_writer( } else { - logInfo(DDSPIPE_ECHO_DISCOVERY, "Ignoring topic " << topic.topic_name() << " as it is not RTPS."); + EPROSIMA_LOG_INFO(DDSPIPE_ECHO_DISCOVERY, "Ignoring topic " << topic.topic_name() << " as it is not RTPS."); } return std::make_shared(); diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 7085ebf2..5221b250 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -60,7 +60,7 @@ CommonParticipant::~CommonParticipant() void CommonParticipant::init() { - logInfo(DDSPIPE_DDS_PARTICIPANT, "Initializing DDS Participant " << id() << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_PARTICIPANT, "Initializing DDS Participant " << id() << "."); // Force DDS entities to be created disabled // NOTE: this is very dangerous because we are modifying a global variable (and a not thread safe one) in a @@ -218,30 +218,30 @@ std::shared_ptr CommonParticipant::create_reader( void CommonParticipant::on_participant_discovery( fastdds::dds::DomainParticipant* participant, fastdds::rtps::ParticipantDiscoveryInfo&& info, - bool&) + bool& /*should_be_ignored*/) { if (info.info.m_guid.guidPrefix != participant->guid().guidPrefix) { if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Participant " << info.info.m_guid << "."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); } } } @@ -249,7 +249,7 @@ void CommonParticipant::on_participant_discovery( void CommonParticipant::on_data_reader_discovery( fastdds::dds::DomainParticipant*, fastdds::rtps::ReaderDiscoveryInfo&& info, - bool&) + bool& /*should_be_ignored*/) { // If reader is from other participant, store it in discovery database if (detail::come_from_same_participant_(info.info.guid(), this->dds_participant_->guid())) @@ -265,7 +265,7 @@ void CommonParticipant::on_data_reader_discovery( // If new endpoint discovered if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_READER) { - logInfo(DDSPIPE_DISCOVERY, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Reader " << info.info.guid() << "."); // TODO check logic because if an endpoint is lost by liveliness it may be inserted again when already in database @@ -273,20 +273,20 @@ void CommonParticipant::on_data_reader_discovery( } else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::CHANGED_QOS_READER) { - logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::REMOVED_READER) { - logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::IGNORED_READER) { - logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -295,7 +295,7 @@ void CommonParticipant::on_data_reader_discovery( void CommonParticipant::on_data_writer_discovery( fastdds::dds::DomainParticipant*, fastdds::rtps::WriterDiscoveryInfo&& info, - bool&) + bool& /*should_be_ignored*/) { // If writer is from other participant, store it in discovery database if (detail::come_from_same_participant_(info.info.guid(), this->dds_participant_->guid())) @@ -311,7 +311,7 @@ void CommonParticipant::on_data_writer_discovery( // If new endpoint discovered if (info.status == fastdds::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_WRITER) { - logInfo(DDSPIPE_DISCOVERY, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Writer " << info.info.guid() << "."); // TODO check logic because if an endpoint is lost by liveliness it may be inserted again when already in database @@ -319,20 +319,20 @@ void CommonParticipant::on_data_writer_discovery( } else if (info.status == fastdds::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) { - logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } else if (info.status == fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER) { - logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } else if (info.status == fastdds::rtps::WriterDiscoveryInfo::IGNORED_WRITER) { - logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index 851ed9a9..7b6ef06d 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -58,7 +58,7 @@ std::shared_ptr XmlParticipant::create_writer( } catch (const utils::InitializationException& e) { - logWarning( + EPROSIMA_LOG_WARNING( DDSPIPE_XMLPARTICIPANT, e.what() << ". Execution continue but this topic will not be published in Participant " << id() << "."); @@ -75,7 +75,7 @@ std::shared_ptr XmlParticipant::create_reader( } catch (const utils::InitializationException& e) { - logWarning( + EPROSIMA_LOG_WARNING( DDSPIPE_XMLPARTICIPANT, e.what() << ". Execution continue but this topic will not be subscribed in Participant " << id() << "."); diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 84b1d16b..e369d5e1 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -132,14 +132,14 @@ void DynTypesParticipant::notify_type_discovered_( const fastdds::dds::xtypes::TypeInformation& type_info, const fastcdr::string_255& type_name) { - const auto type_identifier = type_info.complete().typeid_with_size().type_id(); + const auto type_id = type_info.complete().typeid_with_size().type_id(); fastdds::dds::xtypes::TypeObject dyn_type_object; if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( - type_identifier, + type_id, dyn_type_object)) { - logWarning(DDSPIPE_DYNTYPES_PARTICIPANT, - "Failed to get type object of " << type_name << "type"); + EPROSIMA_LOG_WARNING(DDSPIPE_DYNTYPES_PARTICIPANT, + "Failed to get type object of " << type_name << " type"); return; } @@ -148,14 +148,14 @@ void DynTypesParticipant::notify_type_discovered_( dyn_type_object)->build(); if (!dyn_type) { - logWarning(DDSPIPE_DYNTYPES_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_DYNTYPES_PARTICIPANT, "Failed to create Dynamic Type " << type_name); return; } - // Notify type_identifier and its associated tyme_name. - // NOTE: We assume each type_name corresponds to only one type_identifier - logInfo(DDSPIPE_DYNTYPES_PARTICIPANT, + // Notify type_id and its associated tyme_name. + // NOTE: We assume each type_name corresponds to only one type_id + EPROSIMA_LOG_INFO(DDSPIPE_DYNTYPES_PARTICIPANT, "Participant " << this->id() << " discovered type object " << dyn_type->get_name()); monitor_type_discovered(type_name.to_string()); @@ -164,7 +164,7 @@ void DynTypesParticipant::notify_type_discovered_( auto data = std::make_unique(); data->dynamic_type = dyn_type; // TODO: add constructor with param data->type_name = type_name; - data->type_id = type_identifier; + data->type_id = type_id; // Insert new data in internal reader queue type_object_reader_->simulate_data_reception(std::move(data)); diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/SchemaParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/SchemaParticipant.cpp index 5fbb30e7..0ca32f89 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/SchemaParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/SchemaParticipant.cpp @@ -80,7 +80,7 @@ std::shared_ptr SchemaParticipant::create_writer( { if (!utils::can_cast(topic)) { - logWarning(DDSPIPE_SCHEMA_PARTICIPANT, "Not creating Writer for topic " << topic.topic_name()); + EPROSIMA_LOG_WARNING(DDSPIPE_SCHEMA_PARTICIPANT, "Not creating Writer for topic " << topic.topic_name()); return std::make_shared(); } return std::make_shared(id(), dynamic_cast(topic), payload_pool_, diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 85789006..cd784bf4 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -89,24 +89,24 @@ void CommonParticipant::onParticipantDiscovery( { if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Participant " << info.info.m_guid << "."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); } else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) { - logInfo(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); } } } @@ -123,27 +123,27 @@ void CommonParticipant::onReaderDiscovery( if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERED_READER) { - logInfo(DDSPIPE_DISCOVERY, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Reader " << info.info.guid() << "."); this->discovery_database_->add_endpoint(info_reader); } else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::CHANGED_QOS_READER) { - logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::REMOVED_READER) { - logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::IGNORED_READER) { - logInfo(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -162,27 +162,27 @@ void CommonParticipant::onWriterDiscovery( if (info.status == fastdds::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER) { - logInfo(DDSPIPE_DISCOVERY, + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Found in Participant " << configuration_->id << " new Writer " << info.info.guid() << "."); this->discovery_database_->add_endpoint(info_writer); } else if (info.status == fastdds::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) { - logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } else if (info.status == fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER) { - logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } else if (info.status == fastdds::rtps::WriterDiscoveryInfo::IGNORED_WRITER) { - logInfo(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -217,13 +217,13 @@ CommonParticipant::create_descriptor( if (types::Address::is_ipv4_correct(ip)) { udp_transport->interfaceWhiteList.emplace_back(ip); - logInfo(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, "Adding " << ip << " to UDP whitelist interfaces."); } else { // Invalid address, continue with next one - logWarning(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, "Not valid IPv4. Discarding UDP whitelist interface " << ip << "."); } } @@ -245,13 +245,13 @@ CommonParticipant::create_descriptor( if (types::Address::is_ipv6_correct(ip)) { udp_transport->interfaceWhiteList.emplace_back(ip); - logInfo(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, "Adding " << ip << " to UDP whitelist interfaces."); } else { // Invalid address, continue with next one - logWarning(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, "Not valid IPv6. Discarding UDP whitelist interface " << ip << "."); } } @@ -273,13 +273,13 @@ CommonParticipant::create_descriptor( if (types::Address::is_ipv4_correct(ip)) { tcp_transport->interfaceWhiteList.emplace_back(ip); - logInfo(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, "Adding " << ip << " to TCP whitelist interfaces."); } else { // Invalid address, continue with next one - logWarning(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, "Not valid IPv4. Discarding TCP whitelist interface " << ip << "."); } } @@ -301,13 +301,13 @@ CommonParticipant::create_descriptor( if (types::Address::is_ipv6_correct(ip)) { tcp_transport->interfaceWhiteList.emplace_back(ip); - logInfo(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, "Adding " << ip << " to TCP whitelist interfaces."); } else { // Invalid address, continue with next one - logWarning(DDSPIPE_COMMON_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, "Not valid IPv6. Discarding TCP whitelist interface " << ip << "."); } } @@ -339,7 +339,7 @@ void CommonParticipant::create_participant_( const core::types::DomainId& domain, const fastdds::rtps::RTPSParticipantAttributes& participant_attributes) { - logInfo(DDSPIPE_RTPS_PARTICIPANT, + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_PARTICIPANT, "Creating Participant in domain " << domain); // Listener must be set in creation as no callbacks should be missed @@ -355,7 +355,7 @@ void CommonParticipant::create_participant_( utils::Formatter() << "Error creating RTPS Participant " << this->id()); } - logInfo(DDSPIPE_RTPS_PARTICIPANT, + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_PARTICIPANT, "New Participant created with id " << this->id() << " in domain " << domain << " with guid " << rtps_participant_->getGuid() << (this->is_repeater() ? " (repeater)" : " (non repeater)")); diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index 8940bae1..ca71f9c7 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -73,7 +73,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( if (!address.is_valid()) { // Invalid address, continue with next one - logWarning(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard listening address: " << address << " in Participant " << configuration->id << " initialization."); continue; @@ -204,7 +204,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( if (!connection_address.is_valid()) { // Invalid connection address, continue with next one - logWarning(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard connection address with remote server: " << connection_address.discovery_server_guid_prefix() << " in Participant " << configuration->id << " initialization."); @@ -219,7 +219,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( if (!address.is_valid()) { // Invalid ip address, continue with next one - logWarning(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard connection address with remote server: " << connection_address.discovery_server_guid_prefix() << " due to invalid ip address " << address.ip() << " in Participant " << configuration->id << @@ -229,9 +229,6 @@ DiscoveryServerParticipant::reckon_participant_attributes_( has_connection_addresses = true; - // eprosima::fastdds::rtps::RemoteServerAttributes server_attr; - // server_attr.guidPrefix = server_prefix; - eprosima::fastdds::rtps::Locator_t locator; // KIND @@ -265,8 +262,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_( // Warning: Logical port is not needed unless domain could change // Add as remote server and add it to builtin - // server_attr.metatrafficUnicastLocatorList.push_back(locator); - params.builtin.discovery_config.m_DiscoveryServers.push_back(locator); + params.builtin.metatrafficUnicastLocatorList.push_back(locator); + params.defaultUnicastLocatorList.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Add connection address " << address << " for server " << server_prefix << @@ -288,7 +285,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( if (!has_connection_addresses) { - logWarning(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Creating Participant " << configuration->id << " without listening or connection addresses. " << "It will not communicate with any other Participant."); } diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index 72af219e..5e3d521d 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -68,7 +68,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici if (!address.is_valid()) { // Invalid address, continue with next one - logWarning(DDSPIPE_INITIALPEERS_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_INITIALPEERS_PARTICIPANT, "Discard listening address: " << address << " in Participant " << configuration->id << " initialization."); continue; @@ -200,7 +200,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici if (!connection_address.is_valid()) { // Invalid connection address, continue with next one - logWarning(DDSPIPE_INITIALPEERS_PARTICIPANT, + EPROSIMA_LOG_WARNING(DDSPIPE_INITIALPEERS_PARTICIPANT, "Discard connection address: " << connection_address << " in Participant " << configuration->id << " initialization."); continue; diff --git a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp index 6ccd4f13..233eef7c 100644 --- a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp @@ -48,13 +48,13 @@ CommonReader::~CommonReader() dds_participant_->delete_subscriber(dds_subscriber_); } - logInfo(DDSPIPE_DDS_READER, "Deleting CommonReader created in Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "Deleting CommonReader created in Participant " << participant_id_ << " for topic " << topic_); } void CommonReader::init() { - logInfo(DDSPIPE_DDS_READER, "Initializing reader in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "Initializing reader in " << participant_id_ << " for topic " << topic_ << "."); // Create subscriber dds_subscriber_ = dds_participant_->create_subscriber( @@ -94,7 +94,7 @@ void CommonReader::init() void CommonReader::on_data_available( fastdds::dds::DataReader* /* reader */) { - logInfo(DDSPIPE_DDS_READER, "On data available in reader in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "On data available in reader in " << participant_id_ << " for topic " << topic_ << "."); // The CommonReader notifies the reception of a message to the Monitor when a on_data_available event is received. // An on_data_available event can be received with more than one message, but figuring out the number of messages @@ -112,7 +112,7 @@ void CommonReader::on_sample_lost( fastdds::dds::DataReader* reader, const fastdds::dds::SampleLostStatus& status) { - logWarning(DDSPIPE_DDS_READER, + EPROSIMA_LOG_WARNING(DDSPIPE_DDS_READER, "SAMPLE_LOST | On reader " << *this << " a data sample was lost and will not be received"); monitor_msg_lost(topic_, participant_id_); @@ -122,7 +122,7 @@ void CommonReader::on_requested_incompatible_qos( fastdds::dds::DataReader* reader, const fastdds::dds::RequestedIncompatibleQosStatus& status) { - logWarning(DDSPIPE_DDS_READER, + EPROSIMA_LOG_WARNING(DDSPIPE_DDS_READER, "TOPIC_MISMATCH_QOS | Reader " << *this << " found a remote Writer with incompatible QoS"); monitor_qos_mismatch(topic_); @@ -133,7 +133,7 @@ void CommonReader::on_inconsistent_topic( fastdds::dds::Topic* topic, fastdds::dds::InconsistentTopicStatus status) { - logWarning(DDSPIPE_DDS_READER, + EPROSIMA_LOG_WARNING(DDSPIPE_DDS_READER, "TOPIC_MISMATCH_TYPE | Reader " << *this << " found a remote Writer with same topic name but incompatible type"); @@ -164,7 +164,7 @@ utils::ReturnCode CommonReader::take_nts_( // NOTE: we assume this function is always called from the same thread // NOTE: we assume this function is always called with nullptr data - logInfo(DDSPIPE_DDS_READER, "Taking data in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "Taking data in " << participant_id_ << " for topic " << topic_ << "."); // Check if there is data available if (!(reader_->get_unread_count() > 0)) @@ -191,12 +191,12 @@ utils::ReturnCode CommonReader::take_nts_( } } while (!should_accept_sample_(info)); - logInfo(DDSPIPE_DDS_READER, "Data taken in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "Data taken in " << participant_id_ << " for topic " << topic_ << "."); // Verify that the rtps_data object is valid if (!rtps_data) { - logError(DDSPIPE_DDS_READER, "The data taken by the reader is not valid."); + EPROSIMA_LOG_ERROR(DDSPIPE_DDS_READER, "The data taken by the reader is not valid."); return utils::ReturnCode::ERROR; } diff --git a/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp index 361b3b4d..a6542490 100644 --- a/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/SpecificQoSReader.cpp @@ -58,7 +58,7 @@ void SpecificQoSReader::fill_received_data_( { // Get a message from a writer not in database, this is an error. // Remove data and make as it has not been received. - logError( + EPROSIMA_LOG_ERROR( DDSPIPE_SpecificQoSReader, "Received a message from Writer " << data_to_fill.source_guid << " that is not stored in DB."); } diff --git a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp index 5c993539..182f1f57 100644 --- a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp @@ -39,7 +39,7 @@ SimpleReader::SimpleReader( reckon_topic_attributes_(topic), reckon_reader_qos_(topic)) { - logInfo(DDSPIPE_RPC_READER, "Creating RPC Reader for topic " << topic_); + EPROSIMA_LOG_INFO(DDSPIPE_RPC_READER, "Creating RPC Reader for topic " << topic_); } //! Override Parent method to create an RPC data type. diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 800403ab..05004264 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include +#include #include @@ -78,7 +79,7 @@ CommonReader::~CommonReader() delete rtps_history_; } - logInfo(DDSPIPE_RTPS_READER, "Deleting CommonReader created in Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_READER, "Deleting CommonReader created in Participant " << participant_id_ << " for topic " << topic_); } @@ -133,7 +134,7 @@ void CommonReader::internal_entities_creation_( " for Simple RTPSReader in Participant " << participant_id_); } - logInfo(DDSPIPE_RTPS_READER, "New CommonReader created in Participant " << participant_id_ << " for topic " << + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_READER, "New CommonReader created in Participant " << participant_id_ << " for topic " << topic_ << " with guid " << rtps_reader_->getGuid()); } @@ -416,7 +417,7 @@ void CommonReader::on_new_cache_change_added( } else { - logInfo( + EPROSIMA_LOG_INFO( DDSPIPE_RTPS_COMMONREADER_LISTENER, "Rejected received data in reader " << *this << "."); @@ -438,13 +439,13 @@ void CommonReader::on_reader_matched( { if (info.status == fastdds::rtps::MatchingStatus::MATCHED_MATCHING) { - logInfo(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Reader " << *this << " in topic " << topic_.serialize() << " matched with a new Writer with guid " << info.remoteEndpointGuid); } else { - logInfo(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Reader " << *this << " in topic " << topic_.serialize() << " unmatched with Writer " << info.remoteEndpointGuid); } @@ -467,7 +468,7 @@ void CommonReader::on_sample_lost( fastdds::rtps::RTPSReader*, int32_t sample_lost_since_last_update) noexcept { - logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "SAMPLE_LOST | On reader " << *this << " a data sample was lost and will not be received"); monitor_msg_lost(topic_, participant_id_); @@ -497,7 +498,7 @@ void CommonReader::on_sample_rejected( reason_str = "UNKNOWN"; break; } - logInfo(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Reader " << *this << " rejected a sample from " << change->writerGUID << ". Reason: " << reason_str); } @@ -505,7 +506,7 @@ void CommonReader::on_sample_rejected( void CommonReader::on_incompatible_type( fastdds::rtps::RTPSReader* reader) noexcept { - logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "TOPIC_MISMATCH_TYPE | Reader " << *this << " discovered a Writer with a matching Topic name but with an incompatible type"); @@ -519,7 +520,7 @@ utils::ReturnCode CommonReader::is_data_correct_( // Check that the guid is consistent if (received_change->writerGUID == fastdds::rtps::GUID_t::unknown()) { - logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data without correct writer GUID."); return utils::ReturnCode::ERROR; @@ -531,7 +532,7 @@ utils::ReturnCode CommonReader::is_data_correct_( // Data with 0 bytes is only correct if keyed topic and if data is being disposed if (!(topic_.topic_qos.keyed && received_change->kind != eprosima::fastdds::rtps::ChangeKind_t::ALIVE)) { - logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data with length " << received_change->serializedPayload.length << "."); return utils::ReturnCode::ERROR; diff --git a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp index 357da952..e59b43a0 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp @@ -61,7 +61,7 @@ void SpecificQoSReader::fill_received_data_( { // Get a message from a writer not in database, this is an error. // Remove data and make as it has not been received. - logError( + EPROSIMA_LOG_ERROR( DDSPIPE_SpecificQoSReader, "Received a message from Writer " << data_to_fill.source_guid << " that is not stored in DB."); } diff --git a/ddspipe_participants/src/cpp/types/address/Address.cpp b/ddspipe_participants/src/cpp/types/address/Address.cpp index f4d6ded4..2f5bf16d 100644 --- a/ddspipe_participants/src/cpp/types/address/Address.cpp +++ b/ddspipe_participants/src/cpp/types/address/Address.cpp @@ -74,7 +74,7 @@ Address::Address( } catch (const utils::DNSException& ) { - logWarning( + EPROSIMA_LOG_WARNING( DDSPIPE_ADDRESS, "Address created without IP because given domain " << domain << " was not found."); } } @@ -114,7 +114,7 @@ Address::Address( } catch (const utils::DNSException& ) { - logWarning( + EPROSIMA_LOG_WARNING( DDSPIPE_ADDRESS, "Address created without IP because given domain " << domain << " was not found."); } } @@ -339,7 +339,7 @@ IpType Address::resolve_dns( } else { - logInfo( + EPROSIMA_LOG_INFO( DDSPIPE_ADDRESS, "Getting first IpVersion::v4: " << dns_response.first.begin()->data() << " for Domain name: " << domain << @@ -356,7 +356,7 @@ IpType Address::resolve_dns( } else { - logInfo( + EPROSIMA_LOG_INFO( DDSPIPE_ADDRESS, "Getting first IpVersion::v6: " << dns_response.second.begin()->data() << " for Domain name: " << domain << @@ -383,7 +383,7 @@ std::pair Address::resolve_dns( } else { - logInfo( + EPROSIMA_LOG_INFO( DDSPIPE_ADDRESS, "Getting first IpVersion::v6: " << dns_response.second.begin()->data() << " for Domain name: " << domain << @@ -393,7 +393,7 @@ std::pair Address::resolve_dns( } else { - logInfo( + EPROSIMA_LOG_INFO( DDSPIPE_ADDRESS, "Getting first IpVersion::v4: " << dns_response.first.begin()->data() << " for Domain name: " << domain << diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index 038fd142..7a6f12be 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -68,7 +68,7 @@ bool TopicDataType::serialize( } else { - logWarning(DDSPIPE_DDS_TYPESUPPORT, "Copying the payload between two different payload pools."); + EPROSIMA_LOG_WARNING(DDSPIPE_DDS_TYPESUPPORT, "Copying the payload between two different payload pools."); // The src and dst Payload Pools are different. The payload must be copied. target_payload->copy(&src_payload->payload); diff --git a/ddspipe_participants/src/cpp/types/security/tls/TlsConfiguration.cpp b/ddspipe_participants/src/cpp/types/security/tls/TlsConfiguration.cpp index 0289af91..c2d5e963 100644 --- a/ddspipe_participants/src/cpp/types/security/tls/TlsConfiguration.cpp +++ b/ddspipe_participants/src/cpp/types/security/tls/TlsConfiguration.cpp @@ -61,7 +61,7 @@ void TlsConfiguration::enable_tls( { if (!compatible()) { - logError(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, + EPROSIMA_LOG_ERROR(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "TLS Configuration expected a Client configuration."); throw utils::ConfigurationException("TLS Configuration expected a Client configuration."); } @@ -74,7 +74,7 @@ void TlsConfiguration::enable_tls( { if (!compatible()) { - logError(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, + EPROSIMA_LOG_ERROR(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "TLS Configuration expected a Server configuration."); throw utils::ConfigurationException("TLS Configuration expected a Server configuration."); } diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp index ab937bf0..a60edb63 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index af27b1e7..90773f65 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -49,13 +49,13 @@ CommonWriter::~CommonWriter() dds_participant_->delete_publisher(dds_publisher_); } - logInfo(DDSPIPE_DDS_WRITER, "Deleting CommonWriter created in Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_DDS_WRITER, "Deleting CommonWriter created in Participant " << participant_id_ << " for topic " << topic_); } void CommonWriter::init() { - logInfo(DDSPIPE_DDS_WRITER, "Initializing writer in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_WRITER, "Initializing writer in " << participant_id_ << " for topic " << topic_ << "."); // Create publisher dds_publisher_ = dds_participant_->create_publisher( @@ -105,7 +105,7 @@ CommonWriter::CommonWriter( utils::ReturnCode CommonWriter::write_nts_( core::IRoutingData& data) noexcept { - logInfo(DDSPIPE_DDS_WRITER, "Writing data in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_WRITER, "Writing data in " << participant_id_ << " for topic " << topic_ << "."); auto& rtps_data = dynamic_cast(data); diff --git a/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp index 9dc117d9..6f14ed87 100644 --- a/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/MultiWriter.cpp @@ -56,7 +56,7 @@ MultiWriter::~MultiWriter() writer.second->disable(); } - logInfo(DDSPIPE_RTPS_WRITER, "Deleting MultiWriter created in Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_WRITER, "Deleting MultiWriter created in Participant " << participant_id_ << " for topic " << topic_); } diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp index 239c3c99..ff19f8cf 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp @@ -49,7 +49,7 @@ utils::ReturnCode SchemaWriter::write_nts_( { auto& rtps_data = dynamic_cast(data); - logInfo(DDSPIPE_SCHEMA_WRITER, + EPROSIMA_LOG_INFO(DDSPIPE_SCHEMA_WRITER, "Data in topic: " << topic_ << " received: " << rtps_data.payload @@ -62,7 +62,7 @@ utils::ReturnCode SchemaWriter::write_nts_( } catch (const utils::Exception& e) { - logWarning( + EPROSIMA_LOG_WARNING( DDSPIPE_SCHEMA_WRITER, "Error writting data in topic " << topic_ << " : <" << e.what() << ">."); return utils::ReturnCode::ERROR; diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp index ab7e7486..af825bdd 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp @@ -56,7 +56,7 @@ utils::ReturnCode TypeObjectWriter::write_nts_( } catch (const utils::Exception& e) { - logError( + EPROSIMA_LOG_ERROR( DDSPIPE_TYPEOBJECT_WRITER, "Error generating schema for type " << dynamic_type_data.dynamic_type->get_name() << " : <" << e.what() << ">."); diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index 208f1ab7..fdd001aa 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -47,7 +47,7 @@ SimpleWriter::SimpleWriter( reckon_writer_qos_(topic), reckon_cache_change_pool_configuration_(topic)) { - logInfo(DDSPIPE_RPC_WRITER, "Creating RPC Writer for topic " << topic_); + EPROSIMA_LOG_INFO(DDSPIPE_RPC_WRITER, "Creating RPC Writer for topic " << topic_); } utils::ReturnCode SimpleWriter::fill_to_send_data_( diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index cbc68599..0e09133a 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -13,6 +13,8 @@ // limitations under the License. #include +#include +#include #include #include #include @@ -91,7 +93,7 @@ CommonWriter::~CommonWriter() delete rtps_history_; } - logInfo(DDSPIPE_RTPS_COMMONWRITER, "Deleting CommonWriter created in Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_COMMONWRITER, "Deleting CommonWriter created in Participant " << participant_id_ << " for topic " << topic_); } @@ -113,13 +115,13 @@ void CommonWriter::on_writer_matched( { if (info.status == fastdds::rtps::MatchingStatus::MATCHED_MATCHING) { - logInfo(DDSPIPE_RTPS_COMMONWRITER_LISTENER, + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_COMMONWRITER_LISTENER, "Writer " << *this << " in topic " << topic_.serialize() << " matched with a new Reader with guid " << info.remoteEndpointGuid); } else { - logInfo(DDSPIPE_RTPS_COMMONWRITER_LISTENER, + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_COMMONWRITER_LISTENER, "Writer " << *this << " in topic " << topic_.serialize() << " unmatched with Reader " << info.remoteEndpointGuid); } @@ -196,7 +198,7 @@ utils::ReturnCode CommonWriter::write_nts_( auto ret = fill_to_send_data_(new_change, write_params, rtps_data); if (ret != utils::ReturnCode::OK) { - logError(DDSPIPE_RTPS_COMMONWRITER, "Error setting change to send."); + EPROSIMA_LOG_ERROR(DDSPIPE_RTPS_COMMONWRITER, "Error setting change to send."); return ret; } @@ -234,8 +236,8 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( if (data.payload.length > 0) { if (!payload_pool_->get_payload( - const_cast(data.payload), - (to_send_change_to_fill->serializedPayload))) + data.payload, + to_send_change_to_fill->serializedPayload)) { logDevError(DDSPIPE_RTPS_COMMONWRITER, "Error getting Payload."); return utils::ReturnCode::ERROR; @@ -324,7 +326,7 @@ void CommonWriter::internal_entities_creation_( rtps_writer_->reader_data_filter(data_filter_.get()); - logInfo( + EPROSIMA_LOG_INFO( DDSPIPE_RTPS_COMMONWRITER, "New CommonWriter created in Participant " << participant_id_ << " for topic " << topic_ << diff --git a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp index 6ed23659..cf0fd9e5 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/MultiWriter.cpp @@ -62,7 +62,7 @@ MultiWriter::~MultiWriter() delete writer.second; } - logInfo(DDSPIPE_RTPS_WRITER, "Deleting MultiWriter created in Participant " << + EPROSIMA_LOG_INFO(DDSPIPE_RTPS_WRITER, "Deleting MultiWriter created in Participant " << participant_id_ << " for topic " << topic_); } diff --git a/ddspipe_yaml/src/cpp/YamlReader_types.cpp b/ddspipe_yaml/src/cpp/YamlReader_types.cpp index a542f4bf..8d1868dd 100644 --- a/ddspipe_yaml/src/cpp/YamlReader_types.cpp +++ b/ddspipe_yaml/src/cpp/YamlReader_types.cpp @@ -222,7 +222,7 @@ Address YamlReader::get
( // If neither set, get default if (ip_set && domain_name_set) { - logWarning(ddspipe_YAML, + EPROSIMA_LOG_WARNING(ddspipe_YAML, "Tag <" << ADDRESS_DNS_TAG << "> will not be used as <" << ADDRESS_IP_TAG << "> is set."); domain_name_set = false; } From 2ceb0def6fae51b9a3b04f0c20a11b288e6fdba5 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 30 Jul 2024 08:59:05 +0200 Subject: [PATCH 17/53] Adjust to TopicDataType refactor and removal of WriterProxyData/ReaderProxyData from public API Signed-off-by: Lucia Echevarria --- .../types/logging/LogEntryPubSubTypes.hpp | 46 +- .../status/MonitoringStatusPubSubTypes.hpp | 88 ++-- .../topics/MonitoringTopicsPubSubTypes.hpp | 130 +++--- .../cpp/types/logging/LogEntryPubSubTypes.cxx | 137 +++--- .../status/MonitoringStatusPubSubTypes.cxx | 274 ++++++------ .../topics/MonitoringTopicsPubSubTypes.cxx | 411 ++++++++---------- .../participant/dds/CommonParticipant.hpp | 9 +- .../dynamic_types/DynTypesParticipant.hpp | 16 +- .../participant/rtps/CommonParticipant.hpp | 18 +- .../types/dds/TopicDataType.hpp | 41 +- .../ddspipe_participants/utils/utils.hpp | 34 +- .../cpp/participant/dds/CommonParticipant.cpp | 46 +- .../dynamic_types/DynTypesParticipant.cpp | 34 +- .../participant/rtps/CommonParticipant.cpp | 50 ++- .../src/cpp/types/dds/TopicDataType.cpp | 53 ++- ddspipe_participants/src/cpp/utils/utils.cpp | 51 ++- 16 files changed, 681 insertions(+), 757 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.hpp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.hpp index b9c0ba03..8f821932 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.hpp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryPubSubTypes.hpp @@ -32,10 +32,10 @@ #include "LogEntry.hpp" -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) #error \ Generated LogEntry is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER +#endif // FASTDDS_GEN_API_VER /*! @@ -54,38 +54,30 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport bool serialize( const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( + eProsima_user_DllExport uint32_t calculate_serialized_size( const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry @@ -100,10 +92,6 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override @@ -124,8 +112,10 @@ class LogEntryPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.hpp index f9312894..acd5e220 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusPubSubTypes.hpp @@ -32,10 +32,10 @@ #include "MonitoringStatus.hpp" -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) #error \ Generated MonitoringStatus is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER +#endif // FASTDDS_GEN_API_VER /*! @@ -54,38 +54,30 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport bool serialize( const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( + eProsima_user_DllExport uint32_t calculate_serialized_size( const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry @@ -100,10 +92,6 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override @@ -124,8 +112,10 @@ class MonitoringErrorStatusPubSubType : public eprosima::fastdds::dds::TopicData #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; @@ -145,38 +135,30 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport bool serialize( const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( + eProsima_user_DllExport uint32_t calculate_serialized_size( const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry @@ -191,10 +173,6 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override @@ -215,8 +193,10 @@ class MonitoringStatusPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.hpp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.hpp index 5defce7f..e5065783 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.hpp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsPubSubTypes.hpp @@ -32,10 +32,10 @@ #include "MonitoringTopics.hpp" -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) #error \ Generated MonitoringTopics is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER +#endif // FASTDDS_GEN_API_VER /*! @@ -54,38 +54,30 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport bool serialize( const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( + eProsima_user_DllExport uint32_t calculate_serialized_size( const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry @@ -100,10 +92,6 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override @@ -124,8 +112,10 @@ class DdsTopicDataPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; @@ -145,38 +135,30 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport bool serialize( const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( + eProsima_user_DllExport uint32_t calculate_serialized_size( const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry @@ -191,10 +173,6 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override @@ -215,8 +193,10 @@ class DdsTopicPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; @@ -236,38 +216,30 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport bool serialize( const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - const void* const data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( + eProsima_user_DllExport uint32_t calculate_serialized_size( const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* ihandle, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; //Register TypeObject representation in Fast DDS TypeObjectRegistry @@ -282,10 +254,6 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override @@ -306,8 +274,10 @@ class MonitoringTopicsPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eprosima::fastdds::MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx index ae42b282..047d1f3c 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx @@ -33,49 +33,42 @@ using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; LogEntryPubSubType::LogEntryPubSubType() { - setName("LogEntry"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(LogEntry::getMaxCdrSerializedSize()); -#else - LogEntry_max_cdr_typesize; -#endif + set_name("LogEntry"); + uint32_t type_size = LogEntry_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = LogEntry_max_key_cdr_typesize > 16 ? LogEntry_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = LogEntry_max_key_cdr_typesize > 16 ? LogEntry_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } LogEntryPubSubType::~LogEntryPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool LogEntryPubSubType::serialize( const void* const data, - SerializedPayload_t* payload, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { const LogEntry* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + 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; -#if FASTCDR_VERSION_MAJOR > 1 + 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::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -90,16 +83,12 @@ bool LogEntryPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool LogEntryPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -108,18 +97,14 @@ bool LogEntryPubSubType::deserialize( LogEntry* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + 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; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -132,52 +117,62 @@ bool LogEntryPubSubType::deserialize( return true; } -std::function LogEntryPubSubType::getSerializedSizeProvider( +uint32_t LogEntryPubSubType::calculate_serialized_size( const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + 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; + } } -void* LogEntryPubSubType::createData() +void* LogEntryPubSubType::create_data() { return reinterpret_cast(new LogEntry()); } -void LogEntryPubSubType::deleteData( +void LogEntryPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool LogEntryPubSubType::getKey( +bool LogEntryPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + LogEntry data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool LogEntryPubSubType::compute_key( const void* const data, - InstanceHandle_t* handle, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } @@ -185,35 +180,27 @@ bool LogEntryPubSubType::getKey( const LogEntry* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), LogEntry_max_key_cdr_typesize); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || LogEntry_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx index 2db9a4c4..712b0876 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx @@ -33,49 +33,42 @@ using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; MonitoringErrorStatusPubSubType::MonitoringErrorStatusPubSubType() { - setName("MonitoringErrorStatus"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringErrorStatus::getMaxCdrSerializedSize()); -#else - MonitoringErrorStatus_max_cdr_typesize; -#endif + set_name("MonitoringErrorStatus"); + uint32_t type_size = MonitoringErrorStatus_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = MonitoringErrorStatus_max_key_cdr_typesize > 16 ? MonitoringErrorStatus_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = MonitoringErrorStatus_max_key_cdr_typesize > 16 ? MonitoringErrorStatus_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } MonitoringErrorStatusPubSubType::~MonitoringErrorStatusPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool MonitoringErrorStatusPubSubType::serialize( const void* const data, - SerializedPayload_t* payload, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { const MonitoringErrorStatus* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + 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; -#if FASTCDR_VERSION_MAJOR > 1 + 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::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -90,16 +83,12 @@ bool MonitoringErrorStatusPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool MonitoringErrorStatusPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -108,18 +97,14 @@ bool MonitoringErrorStatusPubSubType::deserialize( MonitoringErrorStatus* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + 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; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -132,52 +117,62 @@ bool MonitoringErrorStatusPubSubType::deserialize( return true; } -std::function MonitoringErrorStatusPubSubType::getSerializedSizeProvider( +uint32_t MonitoringErrorStatusPubSubType::calculate_serialized_size( const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + 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; + } } -void* MonitoringErrorStatusPubSubType::createData() +void* MonitoringErrorStatusPubSubType::create_data() { return reinterpret_cast(new MonitoringErrorStatus()); } -void MonitoringErrorStatusPubSubType::deleteData( +void MonitoringErrorStatusPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool MonitoringErrorStatusPubSubType::getKey( +bool MonitoringErrorStatusPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + MonitoringErrorStatus data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool MonitoringErrorStatusPubSubType::compute_key( const void* const data, - InstanceHandle_t* handle, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } @@ -185,35 +180,27 @@ bool MonitoringErrorStatusPubSubType::getKey( const MonitoringErrorStatus* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), MonitoringErrorStatus_max_key_cdr_typesize); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || MonitoringErrorStatus_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; @@ -226,49 +213,42 @@ void MonitoringErrorStatusPubSubType::register_type_object_representation() MonitoringStatusPubSubType::MonitoringStatusPubSubType() { - setName("MonitoringStatus"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringStatus::getMaxCdrSerializedSize()); -#else - MonitoringStatus_max_cdr_typesize; -#endif + set_name("MonitoringStatus"); + uint32_t type_size = MonitoringStatus_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = MonitoringStatus_max_key_cdr_typesize > 16 ? MonitoringStatus_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = MonitoringStatus_max_key_cdr_typesize > 16 ? MonitoringStatus_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } MonitoringStatusPubSubType::~MonitoringStatusPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool MonitoringStatusPubSubType::serialize( const void* const data, - SerializedPayload_t* payload, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { const MonitoringStatus* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + 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; -#if FASTCDR_VERSION_MAJOR > 1 + 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::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -283,16 +263,12 @@ bool MonitoringStatusPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool MonitoringStatusPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -301,18 +277,14 @@ bool MonitoringStatusPubSubType::deserialize( MonitoringStatus* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + 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; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -325,52 +297,62 @@ bool MonitoringStatusPubSubType::deserialize( return true; } -std::function MonitoringStatusPubSubType::getSerializedSizeProvider( +uint32_t MonitoringStatusPubSubType::calculate_serialized_size( const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + 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; + } } -void* MonitoringStatusPubSubType::createData() +void* MonitoringStatusPubSubType::create_data() { return reinterpret_cast(new MonitoringStatus()); } -void MonitoringStatusPubSubType::deleteData( +void MonitoringStatusPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool MonitoringStatusPubSubType::getKey( +bool MonitoringStatusPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + MonitoringStatus data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool MonitoringStatusPubSubType::compute_key( const void* const data, - InstanceHandle_t* handle, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } @@ -378,35 +360,27 @@ bool MonitoringStatusPubSubType::getKey( const MonitoringStatus* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), MonitoringStatus_max_key_cdr_typesize); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || MonitoringStatus_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx index 940946e1..0f9ea67d 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx @@ -33,49 +33,42 @@ using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; DdsTopicDataPubSubType::DdsTopicDataPubSubType() { - setName("DdsTopicData"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(DdsTopicData::getMaxCdrSerializedSize()); -#else - DdsTopicData_max_cdr_typesize; -#endif + set_name("DdsTopicData"); + uint32_t type_size = DdsTopicData_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = DdsTopicData_max_key_cdr_typesize > 16 ? DdsTopicData_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = DdsTopicData_max_key_cdr_typesize > 16 ? DdsTopicData_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } DdsTopicDataPubSubType::~DdsTopicDataPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool DdsTopicDataPubSubType::serialize( const void* const data, - SerializedPayload_t* payload, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { const DdsTopicData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + 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; -#if FASTCDR_VERSION_MAJOR > 1 + 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::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -90,16 +83,12 @@ bool DdsTopicDataPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool DdsTopicDataPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -108,18 +97,14 @@ bool DdsTopicDataPubSubType::deserialize( DdsTopicData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + 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; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -132,52 +117,62 @@ bool DdsTopicDataPubSubType::deserialize( return true; } -std::function DdsTopicDataPubSubType::getSerializedSizeProvider( +uint32_t DdsTopicDataPubSubType::calculate_serialized_size( const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + 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; + } } -void* DdsTopicDataPubSubType::createData() +void* DdsTopicDataPubSubType::create_data() { return reinterpret_cast(new DdsTopicData()); } -void DdsTopicDataPubSubType::deleteData( +void DdsTopicDataPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool DdsTopicDataPubSubType::getKey( +bool DdsTopicDataPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + DdsTopicData data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool DdsTopicDataPubSubType::compute_key( const void* const data, - InstanceHandle_t* handle, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } @@ -185,35 +180,27 @@ bool DdsTopicDataPubSubType::getKey( const DdsTopicData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), DdsTopicData_max_key_cdr_typesize); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || DdsTopicData_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; @@ -226,49 +213,42 @@ void DdsTopicDataPubSubType::register_type_object_representation() DdsTopicPubSubType::DdsTopicPubSubType() { - setName("DdsTopic"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(DdsTopic::getMaxCdrSerializedSize()); -#else - DdsTopic_max_cdr_typesize; -#endif + set_name("DdsTopic"); + uint32_t type_size = DdsTopic_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = DdsTopic_max_key_cdr_typesize > 16 ? DdsTopic_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = DdsTopic_max_key_cdr_typesize > 16 ? DdsTopic_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } DdsTopicPubSubType::~DdsTopicPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool DdsTopicPubSubType::serialize( const void* const data, - SerializedPayload_t* payload, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { const DdsTopic* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + 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; -#if FASTCDR_VERSION_MAJOR > 1 + 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::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -283,16 +263,12 @@ bool DdsTopicPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool DdsTopicPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -301,18 +277,14 @@ bool DdsTopicPubSubType::deserialize( DdsTopic* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + 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; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -325,52 +297,62 @@ bool DdsTopicPubSubType::deserialize( return true; } -std::function DdsTopicPubSubType::getSerializedSizeProvider( +uint32_t DdsTopicPubSubType::calculate_serialized_size( const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + 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; + } } -void* DdsTopicPubSubType::createData() +void* DdsTopicPubSubType::create_data() { return reinterpret_cast(new DdsTopic()); } -void DdsTopicPubSubType::deleteData( +void DdsTopicPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool DdsTopicPubSubType::getKey( +bool DdsTopicPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + DdsTopic data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool DdsTopicPubSubType::compute_key( const void* const data, - InstanceHandle_t* handle, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } @@ -378,35 +360,27 @@ bool DdsTopicPubSubType::getKey( const DdsTopic* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), DdsTopic_max_key_cdr_typesize); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || DdsTopic_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; @@ -419,49 +393,42 @@ void DdsTopicPubSubType::register_type_object_representation() MonitoringTopicsPubSubType::MonitoringTopicsPubSubType() { - setName("MonitoringTopics"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitoringTopics::getMaxCdrSerializedSize()); -#else - MonitoringTopics_max_cdr_typesize; -#endif + set_name("MonitoringTopics"); + uint32_t type_size = MonitoringTopics_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = MonitoringTopics_max_key_cdr_typesize > 16 ? MonitoringTopics_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = MonitoringTopics_max_key_cdr_typesize > 16 ? MonitoringTopics_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } MonitoringTopicsPubSubType::~MonitoringTopicsPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool MonitoringTopicsPubSubType::serialize( const void* const data, - SerializedPayload_t* payload, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { const MonitoringTopics* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + 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; -#if FASTCDR_VERSION_MAJOR > 1 + 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::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -476,16 +443,12 @@ bool MonitoringTopicsPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool MonitoringTopicsPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -494,18 +457,14 @@ bool MonitoringTopicsPubSubType::deserialize( MonitoringTopics* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + 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 -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + 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; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -518,52 +477,62 @@ bool MonitoringTopicsPubSubType::deserialize( return true; } -std::function MonitoringTopicsPubSubType::getSerializedSizeProvider( +uint32_t MonitoringTopicsPubSubType::calculate_serialized_size( const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - 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; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + 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; + } } -void* MonitoringTopicsPubSubType::createData() +void* MonitoringTopicsPubSubType::create_data() { return reinterpret_cast(new MonitoringTopics()); } -void MonitoringTopicsPubSubType::deleteData( +void MonitoringTopicsPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool MonitoringTopicsPubSubType::getKey( +bool MonitoringTopicsPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + MonitoringTopics data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool MonitoringTopicsPubSubType::compute_key( const void* const data, - InstanceHandle_t* handle, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } @@ -571,35 +540,27 @@ bool MonitoringTopicsPubSubType::getKey( const MonitoringTopics* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), MonitoringTopics_max_key_cdr_typesize); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || MonitoringTopics_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index b5661f5d..f10e46f8 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -18,11 +18,14 @@ #include +#include #include #include #include #include #include +#include +#include #include #include @@ -113,12 +116,14 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain void on_data_reader_discovery( fastdds::dds::DomainParticipant* participant, - fastdds::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::dds::SubscriptionBuiltinTopicData& info, bool& /*should_be_ignored*/) override; void on_data_writer_discovery( fastdds::dds::DomainParticipant* participant, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::dds::PublicationBuiltinTopicData& info, bool& /*should_be_ignored*/) override; protected: diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 2d1f09e0..8ea9d262 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -25,9 +25,11 @@ #include #include #include +#include +#include #include -#include -#include +#include +#include #include #include @@ -78,15 +80,17 @@ class DynTypesParticipant : public rtps::SimpleParticipant const core::ITopic& topic) override; DDSPIPE_PARTICIPANTS_DllAPI - void onReaderDiscovery( + void on_reader_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, bool& should_be_ignored) override; DDSPIPE_PARTICIPANTS_DllAPI - void onWriterDiscovery( + void on_writer_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, bool& should_be_ignored) override; protected: diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index 1c12d19f..5f9bda06 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -16,12 +16,14 @@ #include -#include -#include -#include #include +#include +#include +#include #include +#include #include +#include #include #include @@ -137,9 +139,10 @@ class CommonParticipant * This method adds to database the endpoint discovered or modified. */ DDSPIPE_PARTICIPANTS_DllAPI - virtual void onReaderDiscovery( + virtual void on_reader_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, bool& /*should_be_ignored*/) override; /** @@ -148,9 +151,10 @@ class CommonParticipant * This method adds to database the endpoint discovered or modified. */ DDSPIPE_PARTICIPANTS_DllAPI - virtual void onWriterDiscovery( + virtual void on_writer_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, bool& /*should_be_ignored*/) override; ////////////////// diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp index 78a0ce30..538df020 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp @@ -17,10 +17,12 @@ #include #include +#include #include #include #include #include +#include #include #include @@ -36,7 +38,7 @@ namespace dds { using DataType = core::types::RtpsPayloadData; -class TopicDataType : public eprosima::fastdds::dds::TopicDataType +class TopicDataType : public fastdds::dds::TopicDataType { public: @@ -55,34 +57,43 @@ class TopicDataType : public eprosima::fastdds::dds::TopicDataType //! \c serialize method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI virtual bool serialize( - const void* data, - eprosima::fastdds::rtps::SerializedPayload_t* payload) override; + const void* const data, + fastdds::rtps::SerializedPayload_t& payload, + fastdds::dds::DataRepresentationId_t data_representation) override; //! \c deserialize method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI virtual bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* payload, + fastdds::rtps::SerializedPayload_t& payload, void* data) override; - //! \c getSerializedSizeProvider method overriden from \c TopicDataType + //! \c calculate_serialized_size method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI - virtual std::function getSerializedSizeProvider( - const void* data) override; + virtual uint32_t calculate_serialized_size( + const void* const data, + fastdds::dds::DataRepresentationId_t data_representation) override; - //! \c getKey method overriden from \c TopicDataType + //! \c compute_key method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI - virtual bool getKey( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* handle, + virtual bool compute_key( + fastdds::rtps::SerializedPayload_t& payload, + fastdds::rtps::InstanceHandle_t& handle, + bool force_md5 = false) override; + + //! \c compute_key method overriden from \c TopicDataType + DDSPIPE_PARTICIPANTS_DllAPI + virtual bool compute_key( + const void* const /*data*/, + fastdds::rtps::InstanceHandle_t& /*handle*/, bool force_md5 = false) override; - //! \c createData method overriden from \c TopicDataType + //! \c create_data method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI - virtual void* createData() override; + virtual void* create_data() override; - //! \c deleteData method overriden from \c TopicDataType + //! \c delete_data method overriden from \c TopicDataType DDSPIPE_PARTICIPANTS_DllAPI - virtual void deleteData( + virtual void delete_data( void* data) override; protected: diff --git a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp index 9f1dce11..1cd8b3b2 100644 --- a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp +++ b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp @@ -14,8 +14,8 @@ #pragma once -#include -#include +#include +#include #include #include @@ -29,22 +29,36 @@ namespace participants { namespace detail { /** - * @brief Get the QoS from a Writer from the \c DiscoveryDatabase . + * @brief Checks if the writer/reader is keyed based on its \c GUID_t . */ -core::types::SpecificEndpointQoS specific_qos_of_writer_( - const core::DiscoveryDatabase& database, - const core::types::Guid& guid); +bool is_keyed_( + const eprosima::fastdds::rtps::GUID_t& guid); + +/** + * @brief Common part to create any endpoint from info object + */ +template +core::types::Endpoint create_common_endpoint_from_info_( + const DiscoveryBuiltinTopicData& info, + const core::types::ParticipantId participant_discoverer_id); /** - * @brief Create a endpoint from info object + * @brief Create an endpoint from info object * - * Specialized for \c WriterDiscoveryInfo and \c ReaderDiscoveryInfo . + * Specialized for \c PublicationBuiltinTopicData and \c SubscriptionBuiltinTopicData . */ -template +template core::types::Endpoint create_endpoint_from_info_( - const DiscoveryInfoKind& info, + const DiscoveryBuiltinTopicData& info, const core::types::ParticipantId participant_discoverer_id); +/** + * @brief Get the QoS from a Writer from the \c DiscoveryDatabase . + */ +core::types::SpecificEndpointQoS specific_qos_of_writer_( + const core::DiscoveryDatabase& database, + const core::types::Guid& guid); + bool come_from_same_participant_( const fastdds::rtps::GUID_t src_guid, const fastdds::rtps::GUID_t target_guid) noexcept; diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 5221b250..7c5035d7 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -248,11 +248,12 @@ void CommonParticipant::on_participant_discovery( void CommonParticipant::on_data_reader_discovery( fastdds::dds::DomainParticipant*, - fastdds::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::dds::SubscriptionBuiltinTopicData& info, bool& /*should_be_ignored*/) { // If reader is from other participant, store it in discovery database - if (detail::come_from_same_participant_(info.info.guid(), this->dds_participant_->guid())) + if (detail::come_from_same_participant_(info.guid, this->dds_participant_->guid())) { // Come from this participant, do nothing return; @@ -260,33 +261,33 @@ void CommonParticipant::on_data_reader_discovery( // Calculate endpoint info core::types::Endpoint info_reader = - detail::create_endpoint_from_info_(info, id()); + detail::create_endpoint_from_info_(info, id()); // If new endpoint discovered - if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_READER) + if (reason == fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER) { EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, - "Found in Participant " << configuration_->id << " new Reader " << info.info.guid() << "."); + "Found in Participant " << configuration_->id << " new Reader " << info.guid << "."); // TODO check logic because if an endpoint is lost by liveliness it may be inserted again when already in database this->discovery_database_->add_endpoint(info_reader); } - else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::CHANGED_QOS_READER) + else if (reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::REMOVED_READER) + else if (reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::IGNORED_READER) + else if (reason == fastdds::rtps::ReaderDiscoveryStatus::IGNORED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -294,11 +295,12 @@ void CommonParticipant::on_data_reader_discovery( void CommonParticipant::on_data_writer_discovery( fastdds::dds::DomainParticipant*, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::dds::PublicationBuiltinTopicData& info, bool& /*should_be_ignored*/) { // If writer is from other participant, store it in discovery database - if (detail::come_from_same_participant_(info.info.guid(), this->dds_participant_->guid())) + if (detail::come_from_same_participant_(info.guid, this->dds_participant_->guid())) { // Come from this participant, do nothing return; @@ -306,33 +308,33 @@ void CommonParticipant::on_data_writer_discovery( // Calculate endpoint info core::types::Endpoint info_writer = - detail::create_endpoint_from_info_(info, id()); + detail::create_endpoint_from_info_(info, id()); // If new endpoint discovered - if (info.status == fastdds::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_WRITER) + if (reason == fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER) { EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, - "Found in Participant " << configuration_->id << " new Writer " << info.info.guid() << "."); + "Found in Participant " << configuration_->id << " new Writer " << info.guid << "."); // TODO check logic because if an endpoint is lost by liveliness it may be inserted again when already in database this->discovery_database_->add_endpoint(info_writer); } - else if (info.status == fastdds::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) + else if (reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER) + else if (reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastdds::rtps::WriterDiscoveryInfo::IGNORED_WRITER) + else if (reason == fastdds::rtps::WriterDiscoveryStatus::IGNORED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index e369d5e1..1c161f8b 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -23,8 +23,8 @@ #include #include #include -#include -#include +// #include +// #include #include #include @@ -90,39 +90,37 @@ std::shared_ptr DynTypesParticipant::create_reader( return rtps::SimpleParticipant::create_reader(topic); } -void DynTypesParticipant::onReaderDiscovery( +void DynTypesParticipant::on_reader_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, bool& should_be_ignored) { - if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) + if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { - fastdds::rtps::ReaderProxyData proxy_copy(info.info); - // Get type information - const auto type_info = proxy_copy.type_information().type_information; - const auto type_name = proxy_copy.typeName(); + const auto type_info = info.type_information.type_information; + const auto type_name = info.type_name; - rtps::CommonParticipant::onReaderDiscovery(participant, std::move(info), should_be_ignored); + rtps::CommonParticipant::on_reader_discovery(participant, reason, info, should_be_ignored); notify_type_discovered_(type_info, type_name); } } -void DynTypesParticipant::onWriterDiscovery( +void DynTypesParticipant::on_writer_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, bool& should_be_ignored) { - if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) + if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { - fastdds::rtps::WriterProxyData proxy_copy(info.info); - // Get type information - const auto type_info = proxy_copy.type_information().type_information; - const auto type_name = proxy_copy.typeName(); + const auto type_info = info.type_information.type_information; + const auto type_name = info.type_name; - rtps::CommonParticipant::onWriterDiscovery(participant, std::move(info), should_be_ignored); + rtps::CommonParticipant::on_writer_discovery(participant, reason, info, should_be_ignored); notify_type_discovered_(type_info, type_name); } diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index cd784bf4..cd2e41b0 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -111,78 +111,80 @@ void CommonParticipant::onParticipantDiscovery( } } -void CommonParticipant::onReaderDiscovery( +void CommonParticipant::on_reader_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::ReaderDiscoveryInfo&& info, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, bool&) { - if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) + if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { - core::types::Endpoint info_reader = detail::create_endpoint_from_info_( + core::types::Endpoint info_reader = detail::create_endpoint_from_info_( info, this->id()); - if (info.status == fastdds::rtps::ReaderDiscoveryInfo::DISCOVERED_READER) + if (reason == fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER) { EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, - "Found in Participant " << configuration_->id << " new Reader " << info.info.guid() << "."); + "Found in Participant " << configuration_->id << " new Reader " << info.guid << "."); this->discovery_database_->add_endpoint(info_reader); } - else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::CHANGED_QOS_READER) + else if (reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::REMOVED_READER) + else if (reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } - else if (info.status == fastdds::rtps::ReaderDiscoveryInfo::IGNORED_READER) + else if (reason == fastdds::rtps::ReaderDiscoveryStatus::IGNORED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } } } -void CommonParticipant::onWriterDiscovery( +void CommonParticipant::on_writer_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, bool&) { - if (info.info.guid().guidPrefix != participant->getGuid().guidPrefix) + if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { - core::types::Endpoint info_writer = detail::create_endpoint_from_info_( + core::types::Endpoint info_writer = detail::create_endpoint_from_info_( info, this->id()); - if (info.status == fastdds::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER) + if (reason == fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER) { EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, - "Found in Participant " << configuration_->id << " new Writer " << info.info.guid() << "."); + "Found in Participant " << configuration_->id << " new Writer " << info.guid << "."); this->discovery_database_->add_endpoint(info_writer); } - else if (info.status == fastdds::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) + else if (reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER) + else if (reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } - else if (info.status == fastdds::rtps::WriterDiscoveryInfo::IGNORED_WRITER) + else if (reason == fastdds::rtps::WriterDiscoveryStatus::IGNORED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.info.guid() << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index 7a6f12be..94b36807 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include #include @@ -36,11 +38,11 @@ TopicDataType::TopicDataType( , keyed_(keyed) { // Set topic data - m_typeSize = 4; - m_isGetKeyDefined = keyed_; + max_serialized_type_size = 4; + is_compute_key_provided = keyed_; // Set name - setName(type_name_.c_str()); + set_name(type_name_.c_str()); // Set Type Identifiers type_identifiers_ = type_ids; @@ -53,7 +55,8 @@ TopicDataType::~TopicDataType() bool TopicDataType::serialize( const void* data, - fastdds::rtps::SerializedPayload_t* target_payload) + fastdds::rtps::SerializedPayload_t& target_payload, + fastdds::dds::DataRepresentationId_t data_representation) { const DataType* src_payload = static_cast(data); @@ -64,65 +67,71 @@ bool TopicDataType::serialize( // The src and dst Payload Pools are the same. The payload can be referenced. // We do not call get_payload since Fast-DDS doesn't call release_payload internally. // If we did, there would be leaks. - target_payload->data = src_payload->payload.data; + target_payload.data = src_payload->payload.data; } else { EPROSIMA_LOG_WARNING(DDSPIPE_DDS_TYPESUPPORT, "Copying the payload between two different payload pools."); // The src and dst Payload Pools are different. The payload must be copied. - target_payload->copy(&src_payload->payload); + target_payload.copy(&src_payload->payload); } return true; } bool TopicDataType::deserialize( - eprosima::fastdds::rtps::SerializedPayload_t* src_payload, + fastdds::rtps::SerializedPayload_t& src_payload, void* data) { - logDebug(DDSPIPE_DDS_TYPESUPPORT, "Deserializing data " << *src_payload << "."); + logDebug(DDSPIPE_DDS_TYPESUPPORT, "Deserializing data " << src_payload << "."); DataType* target_payload = static_cast(data); // Get data and store it in PayloadPool - payload_pool_->get_payload(*src_payload, target_payload->payload); + payload_pool_->get_payload(src_payload, target_payload->payload); return true; } -std::function TopicDataType::getSerializedSizeProvider( - const void* data) +uint32_t TopicDataType::calculate_serialized_size( + const void* const data, + fastdds::dds::DataRepresentationId_t /* data_representation */) { - return [data]() -> uint32_t - { - const auto p = static_cast(data); - return p->payload.length; - }; + const auto p = static_cast(data); + return p->payload.length; +} + +bool TopicDataType::compute_key( + fastdds::rtps::SerializedPayload_t& payload, + fastdds::rtps::InstanceHandle_t& handle, + bool /* = false */) +{ + return false; } -bool TopicDataType::getKey( +bool TopicDataType::compute_key( const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t* handle, + fastdds::rtps::InstanceHandle_t& handle, bool /* = false */) { - if (m_isGetKeyDefined) + if (is_compute_key_provided) { // Load the instanceHandle from data into handle const auto p = static_cast(data); - *handle = p->instanceHandle; + handle = p->instanceHandle; return true; } return false; } -void* TopicDataType::createData() +void* TopicDataType::create_data() { return reinterpret_cast(new DataType()); } -void TopicDataType::deleteData( +void TopicDataType::delete_data( void* data) { delete(reinterpret_cast(data)); diff --git a/ddspipe_participants/src/cpp/utils/utils.cpp b/ddspipe_participants/src/cpp/utils/utils.cpp index 59cc224a..7af2a933 100644 --- a/ddspipe_participants/src/cpp/utils/utils.cpp +++ b/ddspipe_participants/src/cpp/utils/utils.cpp @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include + #include #include @@ -25,26 +28,36 @@ namespace ddspipe { namespace participants { namespace detail { -template +bool is_keyed_( + const eprosima::fastdds::rtps::GUID_t& guid) +{ + const eprosima::fastdds::rtps::octet identifier = guid.entityId.value[3]; + + // - For writers: NO_KEY = 0x03, WITH_KEY = 0x02 + // - For readers: NO_KEY = 0x04, WITH_KEY = 0x07 + return (identifier & 0x0F) == 0x02 || (identifier & 0x0F) == 0x07; +} + +template core::types::Endpoint create_common_endpoint_from_info_( - const DiscoveryInfoKind& info, + const DiscoveryBuiltinTopicData& info, const core::types::ParticipantId participant_discoverer_id) { // Endpoint struct to fill core::types::Endpoint endpoint; // Parse GUID - endpoint.guid = info.info.guid(); + endpoint.guid = info.guid; // Parse TopicQoS // Durability - endpoint.topic.topic_qos.durability_qos.set_value(info.info.m_qos.m_durability.durabilityKind()); + endpoint.topic.topic_qos.durability_qos.set_value(info.durability.durabilityKind()); // Reliability - if (info.info.m_qos.m_reliability.kind == fastdds::dds::BEST_EFFORT_RELIABILITY_QOS) + if (info.reliability.kind == fastdds::dds::BEST_EFFORT_RELIABILITY_QOS) { endpoint.topic.topic_qos.reliability_qos.set_value(fastdds::rtps::BEST_EFFORT); } - else if (info.info.m_qos.m_reliability.kind == fastdds::dds::RELIABLE_RELIABILITY_QOS) + else if (info.reliability.kind == fastdds::dds::RELIABLE_RELIABILITY_QOS) { endpoint.topic.topic_qos.reliability_qos.set_value(fastdds::rtps::RELIABLE); } @@ -55,27 +68,27 @@ core::types::Endpoint create_common_endpoint_from_info_( "Invalid ReliabilityQoS value found while parsing DiscoveryInfo for Endpoint creation."); } // Set Topic with Partitions - endpoint.topic.topic_qos.use_partitions.set_value(!info.info.m_qos.m_partition.empty()); + endpoint.topic.topic_qos.use_partitions.set_value(!info.partition.empty()); // Set Topic with ownership - endpoint.topic.topic_qos.ownership_qos.set_value(info.info.m_qos.m_ownership.kind); + endpoint.topic.topic_qos.ownership_qos.set_value(info.ownership.kind); // Set Topic key - endpoint.topic.topic_qos.keyed.set_value(info.info.topicKind() == eprosima::fastdds::rtps::TopicKind_t::WITH_KEY); + endpoint.topic.topic_qos.keyed.set_value(is_keyed_(info.guid)); // Set TypeIdentifier - endpoint.topic.type_ids.type_identifier1(info.info.type_information().type_information.complete().typeid_with_size().type_id()); - endpoint.topic.type_ids.type_identifier2(info.info.type_information().type_information.minimal().typeid_with_size().type_id()); + endpoint.topic.type_ids.type_identifier1(info.type_information.type_information.complete().typeid_with_size().type_id()); + endpoint.topic.type_ids.type_identifier2(info.type_information.type_information.minimal().typeid_with_size().type_id()); // Parse Topic core::types::DdsTopic info_topic; - endpoint.topic.m_topic_name = std::string(info.info.topicName()); - endpoint.topic.type_name = std::string(info.info.typeName()); + endpoint.topic.m_topic_name = std::string(info.topic_name); + endpoint.topic.type_name = std::string(info.type_name); endpoint.topic.m_internal_type_discriminator = core::types::INTERNAL_TOPIC_TYPE_RTPS; endpoint.topic.m_topic_discoverer = participant_discoverer_id; // Parse specific QoS of the entity if (endpoint.topic.topic_qos.has_partitions()) { - endpoint.specific_qos.partitions = info.info.m_qos.m_partition; + endpoint.specific_qos.partitions = info.partition; } // Set participant that discovered @@ -87,8 +100,8 @@ core::types::Endpoint create_common_endpoint_from_info_( template<> DDSPIPE_PARTICIPANTS_DllAPI -core::types::Endpoint create_endpoint_from_info_( - const fastdds::rtps::WriterDiscoveryInfo& info, +core::types::Endpoint create_endpoint_from_info_( + const fastdds::rtps::PublicationBuiltinTopicData& info, const core::types::ParticipantId participant_discoverer_id) { // Create Endpoint from common info @@ -97,7 +110,7 @@ core::types::Endpoint create_endpoint_from_info_ DDSPIPE_PARTICIPANTS_DllAPI -core::types::Endpoint create_endpoint_from_info_( - const fastdds::rtps::ReaderDiscoveryInfo& info, +core::types::Endpoint create_endpoint_from_info_( + const fastdds::rtps::SubscriptionBuiltinTopicData& info, const core::types::ParticipantId participant_discoverer_id) { // Create Endpoint from common info From c53312afba95a58685c4f06b151c5d684957d6b4 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 30 Jul 2024 11:04:10 +0200 Subject: [PATCH 18/53] Update after refactor in Participant discovery information Signed-off-by: Lucia Echevarria --- .../src/cpp/logging/DdsLogConsumer.cpp | 1 - .../test/unittest/logging/constants.hpp | 2 +- .../test/unittest/monitoring/constants.hpp | 2 +- .../participant/dds/CommonParticipant.hpp | 6 ++++- .../participant/rtps/CommonParticipant.hpp | 6 +++-- .../cpp/participant/dds/CommonParticipant.cpp | 25 ++++++++--------- .../participant/rtps/CommonParticipant.cpp | 27 ++++++++++--------- .../src/cpp/writer/dds/CommonWriter.cpp | 2 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 2 +- 9 files changed, 40 insertions(+), 33 deletions(-) diff --git a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp index c46c2cb0..f0fd7cab 100644 --- a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp +++ b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp @@ -59,7 +59,6 @@ DdsLogConsumer::DdsLogConsumer( { // Publish the type type->register_type_object_representation(); - type->auto_fill_type_information(true); } type.register_type(participant_); diff --git a/ddspipe_core/test/unittest/logging/constants.hpp b/ddspipe_core/test/unittest/logging/constants.hpp index 71f65036..7479bbf8 100644 --- a/ddspipe_core/test/unittest/logging/constants.hpp +++ b/ddspipe_core/test/unittest/logging/constants.hpp @@ -34,7 +34,7 @@ using namespace eprosima; using namespace eprosima::ddspipe::core::types; // Maximum time to wait for a sample to arrive. -const auto MAX_WAITING_TIME = fastdds::Duration_t(1); +const auto MAX_WAITING_TIME = fastdds::dds::Duration_t(1); // The domain and topic the Monitor should publish its data in. constexpr DomainIdType DOMAIN = 84; diff --git a/ddspipe_core/test/unittest/monitoring/constants.hpp b/ddspipe_core/test/unittest/monitoring/constants.hpp index 2645f950..0f9a6715 100644 --- a/ddspipe_core/test/unittest/monitoring/constants.hpp +++ b/ddspipe_core/test/unittest/monitoring/constants.hpp @@ -37,7 +37,7 @@ constexpr std::uint32_t PERIOD_MS = 500; constexpr double PERIOD_SECS = (double) PERIOD_MS / 1000; // Maximum time to wait for a sample to arrive. -const auto MAX_WAITING_TIME = fastdds::Duration_t(PERIOD_SECS * 3); +const auto MAX_WAITING_TIME = fastdds::dds::Duration_t(PERIOD_SECS * 3); // The domain and topic the Monitor should publish its data in. constexpr DomainIdType DOMAIN = 84; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index f10e46f8..112b3083 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -18,12 +18,15 @@ #include +#include +#include #include #include #include #include #include #include +#include #include #include @@ -111,7 +114,8 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain void on_participant_discovery( fastdds::dds::DomainParticipant* participant, - fastdds::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::rtps::ParticipantBuiltinTopicData& info, bool& /*should_be_ignored*/) override; void on_data_reader_discovery( diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index 5f9bda06..c139f79b 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -128,9 +129,10 @@ class CommonParticipant * This method only is for debugging purposes. */ DDSPIPE_PARTICIPANTS_DllAPI - virtual void onParticipantDiscovery( + virtual void on_participant_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::rtps::ParticipantBuiltinTopicData& info, bool& /*should_be_ignored*/) override; /** diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 7c5035d7..877fde46 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -217,31 +217,32 @@ std::shared_ptr CommonParticipant::create_reader( void CommonParticipant::on_participant_discovery( fastdds::dds::DomainParticipant* participant, - fastdds::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::rtps::ParticipantBuiltinTopicData& info, bool& /*should_be_ignored*/) { - if (info.info.m_guid.guidPrefix != participant->guid().guidPrefix) + if (info.guid.guidPrefix != participant->guid().guidPrefix) { - if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) + if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT) { EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, - "Found in Participant " << configuration_->id << " new Participant " << info.info.m_guid << "."); + "Found in Participant " << configuration_->id << " new Participant " << info.guid << "."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " changed QoS."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " removed."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " dropped."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::IGNORED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " ignored."); } } } diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index cd2e41b0..6906c367 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -80,33 +80,34 @@ void CommonParticipant::init() participant_attributes_); } -void CommonParticipant::onParticipantDiscovery( +void CommonParticipant::on_participant_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::ParticipantDiscoveryInfo&& info, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::rtps::ParticipantBuiltinTopicData& info, bool&) { - if (info.info.m_guid.guidPrefix != participant->getGuid().guidPrefix) + if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { - if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) + if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT) { EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, - "Found in Participant " << configuration_->id << " new Participant " << info.info.m_guid << "."); + "Found in Participant " << configuration_->id << " new Participant " << info.guid << "."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " changed QoS."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " removed."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " dropped."); } - else if (info.status == fastdds::rtps::ParticipantDiscoveryInfo::IGNORED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::IGNORED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.info.m_guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " ignored."); } } } diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index 90773f65..403d4682 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -173,7 +173,7 @@ fastdds::dds::DataWriterQos CommonWriter::reckon_writer_qos_() const noexcept } // Set minimum deadline so it matches with everything - qos.deadline().period = eprosima::fastdds::Duration_t(0); + qos.deadline().period = eprosima::fastdds::dds::Duration_t(0); return qos; } diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 0e09133a..21ff8e22 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -430,7 +430,7 @@ fastdds::dds::WriterQos CommonWriter::reckon_writer_qos_( : eprosima::fastdds::dds::ReliabilityQosPolicyKind::BEST_EFFORT_RELIABILITY_QOS); // Set minimum deadline so it matches with everything - qos.m_deadline.period = eprosima::fastdds::Duration_t(0); + qos.m_deadline.period = eprosima::fastdds::dds::Duration_t(0); // Partitions and specific ownership strength are not set in common. From 32ae1e8cc690b3fe3bc63bfa3cb9f3646a191f0e Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 30 Jul 2024 12:32:33 +0200 Subject: [PATCH 19/53] Update after TopicAttributes removal from public API Signed-off-by: Lucia Echevarria --- .../reader/rtps/CommonReader.hpp | 24 +++--- .../writer/rpc/SimpleWriter.hpp | 1 - .../writer/rtps/CommonWriter.hpp | 18 +++-- .../writer/rtps/SimpleWriter.hpp | 1 - .../src/cpp/reader/rpc/SimpleReader.cpp | 2 +- .../src/cpp/reader/rtps/CommonReader.cpp | 79 +++++++++++-------- .../src/cpp/reader/rtps/SimpleReader.cpp | 2 +- .../src/cpp/reader/rtps/SpecificQoSReader.cpp | 2 +- .../src/cpp/writer/rpc/SimpleWriter.cpp | 2 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 72 ++++++++++------- .../src/cpp/writer/rtps/QoSSpecificWriter.cpp | 2 +- .../src/cpp/writer/rtps/SimpleWriter.cpp | 2 +- 12 files changed, 118 insertions(+), 89 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index addfcc42..0187f6d0 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -19,13 +19,13 @@ #include #include -#include -#include #include -#include +#include #include -#include +#include +#include #include +#include #include #include @@ -44,7 +44,7 @@ namespace rtps { /** * Abstract generic class for a RTPS Reader wrapper. * - * It implements the ReaderListener for itself with \c onNewCacheChangeAdded and \c onReaderMatched callbacks. + * It implements the ReaderListener for itself with \c on_new_cache_change_added and \c on_reader_matched callbacks. * * @warning This object is not RAII and must be initialized before used. */ @@ -196,7 +196,7 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener fastdds::rtps::RTPSParticipant* rtps_participant, const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::ReaderAttributes& reader_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_desc, const fastdds::dds::ReaderQos& reader_qos); // Specific enable/disable do not need to be implemented @@ -208,7 +208,7 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener virtual void internal_entities_creation_( const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::ReaderAttributes& reader_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_desc, const fastdds::dds::ReaderQos& reader_qos); /** @@ -269,10 +269,14 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener static fastdds::rtps::ReaderAttributes reckon_reader_attributes_( const core::types::DdsTopic& topic) noexcept; - //! Topic Attributes to create RTPS Reader - static fastdds::TopicAttributes reckon_topic_attributes_( + //! TODO + fastdds::rtps::TopicDescription reckon_topic_description_( const core::types::DdsTopic& topic) noexcept; + // //! Topic Attributes to create RTPS Reader + // static fastdds::TopicAttributes reckon_topic_attributes_( + // const core::types::DdsTopic& topic) noexcept; + //! Reader QoS to create RTPS Reader static fastdds::dds::ReaderQos reckon_reader_qos_( const core::types::DdsTopic& topic) noexcept; @@ -322,7 +326,7 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener fastdds::rtps::ReaderAttributes reader_attributes_; //! Topic attributes to create the internal RTPS Reader. - fastdds::TopicAttributes topic_attributes_; + fastdds::rtps::TopicDescription topic_description_; //! Reader QoS to create the internal RTPS Reader. fastdds::dds::ReaderQos reader_qos_; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp index dc819ad2..c74b70be 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rpc/SimpleWriter.hpp @@ -15,7 +15,6 @@ #pragma once #include -#include #include #include #include diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index 402d662d..e1bfbb6b 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -22,8 +22,8 @@ #include #include -#include #include +#include #include #include #include @@ -167,7 +167,7 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener const bool repeater, const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::WriterAttributes& writer_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_description, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration); @@ -230,7 +230,7 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener void internal_entities_creation_( const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::WriterAttributes& writer_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_description, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration); @@ -246,10 +246,14 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener static fastdds::rtps::WriterAttributes reckon_writer_attributes_( const core::types::DdsTopic& topic) noexcept; - //! Topic Attributes to create RTPS Writer - static fastdds::TopicAttributes reckon_topic_attributes_( + //! TODO + fastdds::rtps::TopicDescription reckon_topic_description_( const core::types::DdsTopic& topic) noexcept; + // //! Topic Attributes to create RTPS Writer + // static fastdds::TopicAttributes reckon_topic_attributes_( + // const core::types::DdsTopic& topic) noexcept; + //! QoS for RTPS Writer static fastdds::dds::WriterQos reckon_writer_qos_( const core::types::DdsTopic& topic) noexcept; @@ -293,8 +297,8 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener //! Writer attributes to create the internal RTPS Writer. fastdds::rtps::WriterAttributes writer_attributes_; - //! Topic attributes to create the internal RTPS Writer. - fastdds::TopicAttributes topic_attributes_; + //! TODO + fastdds::rtps::TopicDescription topic_description_; //! Writer QoS to create the internal RTPS Writer. fastdds::dds::WriterQos writer_qos_; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp index 11699727..a09cffd8 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/SimpleWriter.hpp @@ -15,7 +15,6 @@ #pragma once #include -#include #include #include #include diff --git a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp index 182f1f57..402ea971 100644 --- a/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rpc/SimpleReader.cpp @@ -36,7 +36,7 @@ SimpleReader::SimpleReader( participant_id, topic, payload_pool, rtps_participant, reckon_history_attributes_(topic), reckon_reader_attributes_(topic), - reckon_topic_attributes_(topic), + reckon_topic_description_(topic), reckon_reader_qos_(topic)) { EPROSIMA_LOG_INFO(DDSPIPE_RPC_READER, "Creating RPC Reader for topic " << topic_); diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 05004264..445c3d99 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -44,7 +44,7 @@ CommonReader::CommonReader( fastdds::rtps::RTPSParticipant* rtps_participant, const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::ReaderAttributes& reader_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_description, const fastdds::dds::ReaderQos& reader_qos) : BaseReader(participant_id, topic.topic_qos.max_rx_rate, topic.topic_qos.downsampling) , rtps_participant_(rtps_participant) @@ -54,7 +54,7 @@ CommonReader::CommonReader( , rtps_history_(nullptr) , history_attributes_(history_attributes) , reader_attributes_(reader_attributes) - , topic_attributes_(topic_attributes) + , topic_description_(topic_description) , reader_qos_(reader_qos) { // Do nothing. @@ -88,14 +88,14 @@ void CommonReader::init() internal_entities_creation_( history_attributes_, reader_attributes_, - topic_attributes_, + topic_description_, reader_qos_); } void CommonReader::internal_entities_creation_( const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::ReaderAttributes& reader_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_description, const fastdds::dds::ReaderQos& reader_qos) { // Copy reader attributes because fast needs it non const (do not ask why) @@ -126,7 +126,7 @@ void CommonReader::internal_entities_creation_( rtps_reader_->set_listener(this); // Register reader with topic - if (!rtps_participant_->registerReader(rtps_reader_, topic_attributes, reader_qos)) + if (!rtps_participant_->register_reader(rtps_reader_, topic_description, reader_qos)) { // In case it fails, remove reader and throw exception fastdds::rtps::RTPSDomain::removeRTPSReader(rtps_reader_); @@ -323,41 +323,52 @@ fastdds::rtps::ReaderAttributes CommonReader::reckon_reader_attributes_( return att; } -fastdds::TopicAttributes CommonReader::reckon_topic_attributes_( +fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( const core::types::DdsTopic& topic) noexcept { - fastdds::TopicAttributes att; + fastdds::rtps::TopicDescription topic_description; - // Set if topic has key - if (topic.topic_qos.keyed) - { - att.topicKind = eprosima::fastdds::rtps::WITH_KEY; - } - else - { - att.topicKind = eprosima::fastdds::rtps::NO_KEY; - } + topic_description.type_name = topic.m_topic_name; + topic_description.topic_name = topic.type_name; - // Set Topic attributes - att.topicName = topic.m_topic_name; - att.topicDataType = topic.type_name; - - // Set Topic history attributes - att.historyQos.kind = eprosima::fastdds::dds::HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS; - att.historyQos.depth = topic.topic_qos.history_depth; - - // Set TypeInformation of the discovered type - fastdds::dds::xtypes::TypeInformation type_information; - if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - topic.type_ids, - type_information)) - { - att.type_information = type_information; - } - - return att; + return topic_description; } +// fastdds::TopicAttributes CommonReader::reckon_topic_attributes_( +// const core::types::DdsTopic& topic) noexcept +// { +// fastdds::TopicAttributes att; + +// // Set if topic has key +// if (topic.topic_qos.keyed) +// { +// att.topicKind = eprosima::fastdds::rtps::WITH_KEY; +// } +// else +// { +// att.topicKind = eprosima::fastdds::rtps::NO_KEY; +// } + +// // Set Topic attributes +// att.topicName = topic.m_topic_name; +// att.topicDataType = topic.type_name; + +// // Set Topic history attributes +// att.historyQos.kind = eprosima::fastdds::dds::HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS; +// att.historyQos.depth = topic.topic_qos.history_depth; + +// // Set TypeInformation of the discovered type +// fastdds::dds::xtypes::TypeInformation type_information; +// if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( +// topic.type_ids, +// type_information)) +// { +// att.type_information = type_information; +// } + +// return att; +// } + fastdds::dds::ReaderQos CommonReader::reckon_reader_qos_( const core::types::DdsTopic& topic) noexcept { diff --git a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp index 7ca1cbb4..3f4f7789 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SimpleReader.cpp @@ -33,7 +33,7 @@ SimpleReader::SimpleReader( participant_id, topic, payload_pool, rtps_participant, reckon_history_attributes_(topic), reckon_reader_attributes_(topic), - reckon_topic_attributes_(topic), + reckon_topic_description_(topic), reckon_reader_qos_(topic)) { } diff --git a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp index e59b43a0..31b6b2da 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/SpecificQoSReader.cpp @@ -37,7 +37,7 @@ SpecificQoSReader::SpecificQoSReader( participant_id, topic, payload_pool, rtps_participant, reckon_history_attributes_(topic), reckon_reader_attributes_(topic), - reckon_topic_attributes_(topic), + reckon_topic_description_(topic), reckon_reader_qos_(topic)) , discovery_database_(discovery_database) { diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index fdd001aa..7ed957c0 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -43,7 +43,7 @@ SimpleWriter::SimpleWriter( participant_id, topic, payload_pool, rtps_participant, repeater, reckon_history_attributes_(topic), reckon_writer_attributes_(topic), - reckon_topic_attributes_(topic), + reckon_topic_description_(topic), reckon_writer_qos_(topic), reckon_cache_change_pool_configuration_(topic)) { diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 21ff8e22..0bc5bac0 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -48,7 +49,7 @@ CommonWriter::CommonWriter( const bool repeater, const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::WriterAttributes& writer_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_description, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration) : BaseWriter(participant_id, topic.topic_qos.max_tx_rate) @@ -60,7 +61,7 @@ CommonWriter::CommonWriter( , rtps_history_(nullptr) , history_attributes_(history_attributes) , writer_attributes_(writer_attributes) - , topic_attributes_(topic_attributes) + , topic_description_(topic_description) , writer_qos_(writer_qos) , pool_configuration_(pool_configuration) { @@ -102,7 +103,7 @@ void CommonWriter::init() internal_entities_creation_( history_attributes_, writer_attributes_, - topic_attributes_, + topic_description_, writer_qos_, pool_configuration_); } @@ -263,7 +264,7 @@ void CommonWriter::fill_sent_data_( void CommonWriter::internal_entities_creation_( const fastdds::rtps::HistoryAttributes& history_attributes, const fastdds::rtps::WriterAttributes& writer_attributes, - const fastdds::TopicAttributes& topic_attributes, + const fastdds::rtps::TopicDescription& topic_description, const fastdds::dds::WriterQos& writer_qos, const utils::PoolConfiguration& pool_configuration) { @@ -305,7 +306,7 @@ void CommonWriter::internal_entities_creation_( } // Register writer with topic - if (!rtps_participant_->registerWriter(rtps_writer_, topic_attributes, writer_qos)) + if (!rtps_participant_->register_writer(rtps_writer_, topic_description, writer_qos)) { // In case it fails, remove writer and throw exception fastdds::rtps::RTPSDomain::removeRTPSWriter(rtps_writer_); @@ -381,37 +382,48 @@ fastdds::rtps::WriterAttributes CommonWriter::reckon_writer_attributes_( return att; } -fastdds::TopicAttributes CommonWriter::reckon_topic_attributes_( +fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( const core::types::DdsTopic& topic) noexcept { - fastdds::TopicAttributes att; + fastdds::rtps::TopicDescription topic_description; - // Set if topic has key - if (topic.topic_qos.keyed) - { - att.topicKind = eprosima::fastdds::rtps::WITH_KEY; - } - else - { - att.topicKind = eprosima::fastdds::rtps::NO_KEY; - } + topic_description.type_name = topic.m_topic_name; + topic_description.topic_name = topic.type_name; - // Set Topic attributes - att.topicName = topic.m_topic_name; - att.topicDataType = topic.type_name; - - // Set TypeInformation of the discovered type - fastdds::dds::xtypes::TypeInformation type_information; - if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - topic.type_ids, - type_information)) - { - att.type_information = type_information; - } - - return att; + return topic_description; } +// fastdds::TopicAttributes CommonWriter::reckon_topic_attributes_( +// const core::types::DdsTopic& topic) noexcept +// { +// fastdds::TopicAttributes att; + +// // Set if topic has key +// if (topic.topic_qos.keyed) +// { +// att.topicKind = eprosima::fastdds::rtps::WITH_KEY; +// } +// else +// { +// att.topicKind = eprosima::fastdds::rtps::NO_KEY; +// } + +// // Set Topic attributes +// att.topicName = topic.m_topic_name; +// att.topicDataType = topic.type_name; + +// // Set TypeInformation of the discovered type +// fastdds::dds::xtypes::TypeInformation type_information; +// if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( +// topic.type_ids, +// type_information)) +// { +// att.type_information = type_information; +// } + +// return att; +// } + fastdds::dds::WriterQos CommonWriter::reckon_writer_qos_( const core::types::DdsTopic& topic) noexcept { diff --git a/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp index 949f08ab..a4041eb5 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/QoSSpecificWriter.cpp @@ -33,7 +33,7 @@ QoSSpecificWriter::QoSSpecificWriter( participant_id, topic, payload_pool, rtps_participant, repeater , reckon_history_attributes_(topic) , reckon_writer_attributes_(topic) - , reckon_topic_attributes_(topic) + , reckon_topic_description_(topic) , reckon_writer_qos_(specific_qos, topic) // this modifies the qos of the Common Writer , reckon_cache_change_pool_configuration_(topic)) , specific_qos_(specific_qos) diff --git a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp index 0e01a6fc..69b4edbb 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/SimpleWriter.cpp @@ -41,7 +41,7 @@ SimpleWriter::SimpleWriter( participant_id, topic, payload_pool, rtps_participant, repeater, reckon_history_attributes_(topic), reckon_writer_attributes_(topic), - reckon_topic_attributes_(topic), + reckon_topic_description_(topic), reckon_writer_qos_(topic), reckon_cache_change_pool_configuration_(topic)) { From 54db70a360b405a804b283ea7d9b3855e4db8697 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 30 Jul 2024 15:40:50 +0200 Subject: [PATCH 20/53] Regenerate types Signed-off-by: Lucia Echevarria --- .../types/logging/LogEntryCdrAux.ipp | 3 ++- .../status/MonitoringStatusCdrAux.ipp | 15 +++++++++++ .../topics/MonitoringTopicsCdrAux.ipp | 25 +++++++++++++++++++ .../cpp/types/logging/LogEntryPubSubTypes.cxx | 3 ++- .../status/MonitoringStatusPubSubTypes.cxx | 6 +++-- .../topics/MonitoringTopicsPubSubTypes.cxx | 9 ++++--- .../dynamic_types/DynTypesParticipant.cpp | 2 -- 7 files changed, 54 insertions(+), 9 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp index 850ff708..b7485cdc 100644 --- a/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/logging/LogEntryCdrAux.ipp @@ -137,9 +137,10 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const LogEntry& data) { + static_cast(scdr); static_cast(data); - scdr << data.event(); + scdr << data.event(); diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp index b5d3bd7f..21d359ab 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/status/MonitoringStatusCdrAux.ipp @@ -113,8 +113,13 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const MonitoringErrorStatus& data) { + static_cast(scdr); static_cast(data); + scdr << data.type_mismatch(); + + scdr << data.qos_mismatch(); + } @@ -197,8 +202,18 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const MonitoringStatus& data) { + extern void serialize_key( + Cdr& scdr, + const MonitoringErrorStatus& data); + + + static_cast(scdr); static_cast(data); + serialize_key(scdr, data.error_status()); + + scdr << data.has_errors(); + } diff --git a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp index d617bd3a..58808316 100644 --- a/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp +++ b/ddspipe_core/include/ddspipe_core/types/monitoring/topics/MonitoringTopicsCdrAux.ipp @@ -129,8 +129,17 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const DdsTopicData& data) { + static_cast(scdr); static_cast(data); + scdr << data.participant_id(); + + scdr << data.msgs_lost(); + + scdr << data.msgs_received(); + + scdr << data.msg_rx_rate(); + } @@ -245,8 +254,21 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const DdsTopic& data) { + static_cast(scdr); static_cast(data); + scdr << data.name(); + + scdr << data.type_name(); + + scdr << data.type_discovered(); + + scdr << data.type_mismatch(); + + scdr << data.qos_mismatch(); + + scdr << data.data(); + } @@ -321,8 +343,11 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const MonitoringTopics& data) { + static_cast(scdr); static_cast(data); + scdr << data.topics(); + } diff --git a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx index 047d1f3c..591feabb 100644 --- a/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/logging/LogEntryPubSubTypes.cxx @@ -184,7 +184,8 @@ bool LogEntryPubSubType::compute_key( LogEntry_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 || LogEntry_max_key_cdr_typesize > 16) { diff --git a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx index 712b0876..d2f46c24 100644 --- a/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/status/MonitoringStatusPubSubTypes.cxx @@ -184,7 +184,8 @@ bool MonitoringErrorStatusPubSubType::compute_key( MonitoringErrorStatus_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 || MonitoringErrorStatus_max_key_cdr_typesize > 16) { @@ -364,7 +365,8 @@ bool MonitoringStatusPubSubType::compute_key( MonitoringStatus_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 || MonitoringStatus_max_key_cdr_typesize > 16) { diff --git a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx index 0f9ea67d..e2d82a5d 100644 --- a/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx +++ b/ddspipe_core/src/cpp/types/monitoring/topics/MonitoringTopicsPubSubTypes.cxx @@ -184,7 +184,8 @@ bool DdsTopicDataPubSubType::compute_key( DdsTopicData_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 || DdsTopicData_max_key_cdr_typesize > 16) { @@ -364,7 +365,8 @@ bool DdsTopicPubSubType::compute_key( DdsTopic_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 || DdsTopic_max_key_cdr_typesize > 16) { @@ -544,7 +546,8 @@ bool MonitoringTopicsPubSubType::compute_key( MonitoringTopics_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 || MonitoringTopics_max_key_cdr_typesize > 16) { diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 1c161f8b..7c4e0560 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -23,8 +23,6 @@ #include #include #include -// #include -// #include #include #include From f44cbb19b7ffb756e2bb4f2e11462c7d72c1f734 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Wed, 7 Aug 2024 10:52:15 +0200 Subject: [PATCH 21/53] Fix TopicDescription in CommonReader and CommonWriter Signed-off-by: Lucia Echevarria --- .../reader/rtps/CommonReader.hpp | 4 -- .../writer/rtps/CommonWriter.hpp | 4 -- .../src/cpp/reader/rtps/CommonReader.cpp | 51 +++++-------------- .../src/cpp/writer/rtps/CommonWriter.cpp | 44 ++++------------ 4 files changed, 25 insertions(+), 78 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index 0187f6d0..ca6a1fe5 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -273,10 +273,6 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener fastdds::rtps::TopicDescription reckon_topic_description_( const core::types::DdsTopic& topic) noexcept; - // //! Topic Attributes to create RTPS Reader - // static fastdds::TopicAttributes reckon_topic_attributes_( - // const core::types::DdsTopic& topic) noexcept; - //! Reader QoS to create RTPS Reader static fastdds::dds::ReaderQos reckon_reader_qos_( const core::types::DdsTopic& topic) noexcept; diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index e1bfbb6b..e48be2c5 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -250,10 +250,6 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener fastdds::rtps::TopicDescription reckon_topic_description_( const core::types::DdsTopic& topic) noexcept; - // //! Topic Attributes to create RTPS Writer - // static fastdds::TopicAttributes reckon_topic_attributes_( - // const core::types::DdsTopic& topic) noexcept; - //! QoS for RTPS Writer static fastdds::dds::WriterQos reckon_writer_qos_( const core::types::DdsTopic& topic) noexcept; diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 445c3d99..121f5c65 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -328,47 +328,24 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( { fastdds::rtps::TopicDescription topic_description; - topic_description.type_name = topic.m_topic_name; - topic_description.topic_name = topic.type_name; + topic_description.topic_name = topic.m_topic_name; + topic_description.type_name = topic.type_name; + + fastdds::dds::xtypes::TypeIdentifierPair type_ids_pair; + type_ids_pair.type_identifier1(topic.type_ids.type_identifier1()); + + // Set TypeInformation of the discovered type + fastdds::dds::xtypes::TypeInformation type_information; + if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( + type_ids_pair, + type_information)) + { + topic_description.type_information = type_information; + } return topic_description; } -// fastdds::TopicAttributes CommonReader::reckon_topic_attributes_( -// const core::types::DdsTopic& topic) noexcept -// { -// fastdds::TopicAttributes att; - -// // Set if topic has key -// if (topic.topic_qos.keyed) -// { -// att.topicKind = eprosima::fastdds::rtps::WITH_KEY; -// } -// else -// { -// att.topicKind = eprosima::fastdds::rtps::NO_KEY; -// } - -// // Set Topic attributes -// att.topicName = topic.m_topic_name; -// att.topicDataType = topic.type_name; - -// // Set Topic history attributes -// att.historyQos.kind = eprosima::fastdds::dds::HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS; -// att.historyQos.depth = topic.topic_qos.history_depth; - -// // Set TypeInformation of the discovered type -// fastdds::dds::xtypes::TypeInformation type_information; -// if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( -// topic.type_ids, -// type_information)) -// { -// att.type_information = type_information; -// } - -// return att; -// } - fastdds::dds::ReaderQos CommonReader::reckon_reader_qos_( const core::types::DdsTopic& topic) noexcept { diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 0bc5bac0..21ac9bb4 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -387,43 +387,21 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( { fastdds::rtps::TopicDescription topic_description; - topic_description.type_name = topic.m_topic_name; - topic_description.topic_name = topic.type_name; + topic_description.type_name = topic.type_name; + topic_description.topic_name = topic.m_topic_name; + + // Set TypeInformation of the discovered type + fastdds::dds::xtypes::TypeInformation type_information; + if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( + topic.type_ids, + type_information)) + { + topic_description.type_information = type_information; + } return topic_description; } -// fastdds::TopicAttributes CommonWriter::reckon_topic_attributes_( -// const core::types::DdsTopic& topic) noexcept -// { -// fastdds::TopicAttributes att; - -// // Set if topic has key -// if (topic.topic_qos.keyed) -// { -// att.topicKind = eprosima::fastdds::rtps::WITH_KEY; -// } -// else -// { -// att.topicKind = eprosima::fastdds::rtps::NO_KEY; -// } - -// // Set Topic attributes -// att.topicName = topic.m_topic_name; -// att.topicDataType = topic.type_name; - -// // Set TypeInformation of the discovered type -// fastdds::dds::xtypes::TypeInformation type_information; -// if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( -// topic.type_ids, -// type_information)) -// { -// att.type_information = type_information; -// } - -// return att; -// } - fastdds::dds::WriterQos CommonWriter::reckon_writer_qos_( const core::types::DdsTopic& topic) noexcept { From 73749759c3aafa5c801483325555b63a76095240 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 13 Aug 2024 08:08:42 +0200 Subject: [PATCH 22/53] Apply suggested changes Signed-off-by: Lucia Echevarria --- .../DdsPublishingConfiguration.hpp | 3 - .../dynamic/DiscoveryDatabase.hpp | 2 +- .../efficiency/payload/PayloadPool.hpp | 4 +- .../payload/PayloadPoolMediator.hpp | 20 +- .../ddspipe_core/types/dds/Endpoint.hpp | 18 +- .../ddspipe_core/types/dds/Payload.hpp | 5 +- .../types/dynamic_types/types.hpp | 4 +- .../ddspipe_core/types/topic/dds/DdsTopic.hpp | 2 +- .../src/cpp/communication/dds/Track.cpp | 6 +- .../src/cpp/communication/rpc/RpcBridge.cpp | 6 +- ddspipe_core/src/cpp/core/DdsPipe.cpp | 21 +- .../src/cpp/dynamic/DiscoveryDatabase.cpp | 2 +- .../efficiency/payload/CopyPayloadPool.cpp | 2 - .../efficiency/payload/FastPayloadPool.cpp | 1 - .../cpp/efficiency/payload/MapPayloadPool.cpp | 2 - .../cpp/efficiency/payload/PayloadPool.cpp | 12 +- .../payload/PayloadPoolMediator.cpp | 6 +- .../src/cpp/logging/DdsLogConsumer.cpp | 6 - .../cpp/types/dynamic_types/schema_msg.cpp | 44 +- .../src/cpp/types/dynamic_types/types.cpp | 3 +- .../src/cpp/types/topic/dds/DdsTopic.cpp | 2 +- .../efficiency/FastPayloadPoolTest.cpp | 2 - .../efficiency/MapPayloadPoolTest.cpp | 36 +- .../unittest/efficiency/PayloadPoolTest.cpp | 145 +--- .../dds_consumer/DdsLogConsumerTest.cpp | 12 +- .../test/unittest/types/CMakeLists.txt | 1 + .../types/dynamic_types/CMakeLists.txt | 57 ++ .../types/dynamic_types/dtypes_msg_tests.cpp | 111 +++ .../types/dynamic_types/types/all_types.hpp | 141 ++++ .../types/idls/arrays_and_sequences.idl | 12 + .../types/idls/basic_array_struct.idl | 11 + .../dynamic_types/types/idls/basic_struct.idl | 9 + .../types/idls/char_sequence.idl | 4 + .../types/idls/complex_nested_arrays.idl | 23 + .../types/idls/float_bounded_sequence.idl | 4 + .../dynamic_types/types/idls/hello_world.idl | 5 + .../types/idls/numeric_array.idl | 4 + .../types/msgs/arrays_and_sequences.msg | 7 + .../types/msgs/basic_array_struct.msg | 6 + .../dynamic_types/types/msgs/basic_struct.msg | 4 + .../types/msgs/char_sequence.msg | 1 + .../types/msgs/complex_nested_arrays.msg | 14 + .../types/msgs/float_bounded_sequence.msg | 1 + .../dynamic_types/types/msgs/hello_world.msg | 2 + .../types/msgs/numeric_array.msg | 1 + .../type_objects/arrays_and_sequences.hpp | 445 ++++++++++ .../arrays_and_sequencesCdrAux.hpp | 53 ++ .../arrays_and_sequencesCdrAux.ipp | 230 ++++++ .../arrays_and_sequencesPubSubTypes.cxx | 398 +++++++++ .../arrays_and_sequencesPubSubTypes.hpp | 204 +++++ .../arrays_and_sequencesTypeObjectSupport.cxx | 341 ++++++++ .../arrays_and_sequencesTypeObjectSupport.hpp | 68 ++ .../types/type_objects/basic_array_struct.hpp | 386 +++++++++ .../type_objects/basic_array_structCdrAux.hpp | 53 ++ .../type_objects/basic_array_structCdrAux.ipp | 220 +++++ .../basic_array_structPubSubTypes.cxx | 398 +++++++++ .../basic_array_structPubSubTypes.hpp | 204 +++++ .../basic_array_structTypeObjectSupport.cxx | 251 ++++++ .../basic_array_structTypeObjectSupport.hpp | 68 ++ .../types/type_objects/basic_struct.hpp | 311 +++++++ .../types/type_objects/basic_structCdrAux.hpp | 53 ++ .../types/type_objects/basic_structCdrAux.ipp | 204 +++++ .../type_objects/basic_structPubSubTypes.cxx | 398 +++++++++ .../type_objects/basic_structPubSubTypes.hpp | 204 +++++ .../basic_structTypeObjectSupport.cxx | 157 ++++ .../basic_structTypeObjectSupport.hpp | 68 ++ .../types/type_objects/char_sequence.hpp | 190 +++++ .../type_objects/char_sequenceCdrAux.hpp | 46 ++ .../type_objects/char_sequenceCdrAux.ipp | 121 +++ .../type_objects/char_sequencePubSubTypes.cxx | 217 +++++ .../type_objects/char_sequencePubSubTypes.hpp | 123 +++ .../char_sequenceTypeObjectSupport.cxx | 132 +++ .../char_sequenceTypeObjectSupport.hpp | 56 ++ .../type_objects/complex_nested_arrays.hpp | 760 ++++++++++++++++++ .../complex_nested_arraysCdrAux.hpp | 67 ++ .../complex_nested_arraysCdrAux.ipp | 407 ++++++++++ .../complex_nested_arraysPubSubTypes.cxx | 760 ++++++++++++++++++ .../complex_nested_arraysPubSubTypes.hpp | 366 +++++++++ ...complex_nested_arraysTypeObjectSupport.cxx | 493 ++++++++++++ ...complex_nested_arraysTypeObjectSupport.hpp | 92 +++ .../type_objects/float_bounded_sequence.hpp | 190 +++++ .../float_bounded_sequenceCdrAux.hpp | 46 ++ .../float_bounded_sequenceCdrAux.ipp | 121 +++ .../float_bounded_sequencePubSubTypes.cxx | 217 +++++ .../float_bounded_sequencePubSubTypes.hpp | 123 +++ ...loat_bounded_sequenceTypeObjectSupport.cxx | 132 +++ ...loat_bounded_sequenceTypeObjectSupport.hpp | 56 ++ .../types/type_objects/hello_world.hpp | 227 ++++++ .../types/type_objects/hello_worldCdrAux.hpp | 46 ++ .../types/type_objects/hello_worldCdrAux.ipp | 131 +++ .../type_objects/hello_worldPubSubTypes.cxx | 217 +++++ .../type_objects/hello_worldPubSubTypes.hpp | 123 +++ .../hello_worldTypeObjectSupport.cxx | 138 ++++ .../hello_worldTypeObjectSupport.hpp | 56 ++ .../types/type_objects/numeric_array.hpp | 189 +++++ .../type_objects/numeric_arrayCdrAux.hpp | 46 ++ .../type_objects/numeric_arrayCdrAux.ipp | 121 +++ .../type_objects/numeric_arrayPubSubTypes.cxx | 217 +++++ .../type_objects/numeric_arrayPubSubTypes.hpp | 123 +++ .../numeric_arrayTypeObjectSupport.cxx | 134 +++ .../numeric_arrayTypeObjectSupport.hpp | 56 ++ .../dynamic_types/DynTypesParticipant.hpp | 11 +- .../dynamic_types/ISchemaHandler.hpp | 3 +- .../reader/rtps/CommonReader.hpp | 4 +- .../types/dds/TopicDataType.hpp | 2 +- .../writer/rtps/CommonWriter.hpp | 4 +- .../cpp/participant/dds/CommonParticipant.cpp | 2 +- .../dynamic_types/DynTypesParticipant.cpp | 41 +- .../rtps/DiscoveryServerParticipant.cpp | 3 +- .../src/cpp/reader/auxiliar/BaseReader.cpp | 2 +- .../src/cpp/reader/auxiliar/BlankReader.cpp | 2 +- .../cpp/reader/auxiliar/InternalReader.cpp | 4 +- .../src/cpp/reader/dds/CommonReader.cpp | 6 +- .../src/cpp/reader/rtps/CommonReader.cpp | 20 +- .../cpp/testing/entities/mock_entities.cpp | 6 +- .../src/cpp/types/dds/TopicDataType.cpp | 4 +- ddspipe_participants/src/cpp/utils/utils.cpp | 4 +- .../src/cpp/writer/auxiliar/BaseWriter.cpp | 4 +- .../src/cpp/writer/auxiliar/BlankWriter.cpp | 2 +- .../cpp/writer/auxiliar/RtpsEchoWriter.cpp | 2 +- .../src/cpp/writer/dds/CommonWriter.cpp | 9 +- .../cpp/writer/dynamic_types/SchemaWriter.cpp | 4 +- .../writer/dynamic_types/TypeObjectWriter.cpp | 6 +- .../src/cpp/writer/rpc/SimpleWriter.cpp | 2 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 12 +- .../src/cpp/xml/XmlHandler.cpp | 8 +- .../ddspipe_yaml/yaml_configuration_tags.hpp | 1 - ddspipe_yaml/src/cpp/YamlReader_types.cpp | 6 - 128 files changed, 11865 insertions(+), 346 deletions(-) create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx create mode 100644 ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp diff --git a/ddspipe_core/include/ddspipe_core/configuration/DdsPublishingConfiguration.hpp b/ddspipe_core/include/ddspipe_core/configuration/DdsPublishingConfiguration.hpp index ffcb2224..18841f30 100644 --- a/ddspipe_core/include/ddspipe_core/configuration/DdsPublishingConfiguration.hpp +++ b/ddspipe_core/include/ddspipe_core/configuration/DdsPublishingConfiguration.hpp @@ -56,9 +56,6 @@ struct DdsPublishingConfiguration : public IConfiguration //! The DDS topic name to publish in. std::string topic_name{}; - - //! Whether the LogEntry type should be published or not. - bool publish_type = false; }; } /* namespace core */ diff --git a/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp b/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp index 1218c441..cc324875 100644 --- a/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp +++ b/ddspipe_core/include/ddspipe_core/dynamic/DiscoveryDatabase.hpp @@ -23,8 +23,8 @@ #include #include -#include #include +#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp index 0b51137f..b6565343 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp @@ -70,7 +70,7 @@ class PayloadPool : public eprosima::fastdds::rtps::IPayloadPool DDSPIPE_CORE_DllAPI virtual bool reserve_( uint32_t size, - eprosima::fastdds::rtps::SerializedPayload_t& payload); + types::Payload& payload); /** * @brief Free a memory space. @@ -86,7 +86,7 @@ class PayloadPool : public eprosima::fastdds::rtps::IPayloadPool */ DDSPIPE_CORE_DllAPI virtual bool release_( - eprosima::fastdds::rtps::SerializedPayload_t& payload); + types::Payload& payload); //! Increase \c reserve_count_ DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp index bb2b1c01..5f318094 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp @@ -18,13 +18,13 @@ #include #include -#include - #include #include #include #include +#include + #include #include @@ -66,11 +66,10 @@ class PayloadPoolMediator : public fastdds::rtps::IPayloadPool * @param writer the writer who has to write the \c data. * @param data the data to be written by the \c writer. * - * @return true if everything OK - * @return false if something went wrong + * @return ReturnCode::OK if the data is correctly sent or a ReturnCode related to the specific error otherwise. */ DDSPIPE_CORE_DllAPI - bool write( + utils::ReturnCode write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data); @@ -90,11 +89,10 @@ class PayloadPoolMediator : public fastdds::rtps::IPayloadPool * @param data the data to be written by the \c writer. * @param params the data to be written by the \c writer. * - * @return true if everything OK - * @return false if something went wrong + * @return ReturnCode::OK if the data is correctly sent or a ReturnCode related to the specific error otherwise. */ DDSPIPE_CORE_DllAPI - bool write( + utils::ReturnCode write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, fastdds::rtps::WriteParams& params); @@ -115,11 +113,11 @@ class PayloadPoolMediator : public fastdds::rtps::IPayloadPool * @param data the data to be written by the \c writer. * @param handle the data to be used by the \c writer. * - * @return true if everything OK - * @return false if something went wrong + * @return ReturnCode::PRECONDITION_NOT_MET if the handle introduced does not match with the one associated to the + * data, ReturnCode::OK if the data is correctly sent and ReturnCode::ERROR otherwise. */ DDSPIPE_CORE_DllAPI - fastdds::dds::ReturnCode_t write( + utils::ReturnCode write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, const fastdds::rtps::InstanceHandle_t& handle); diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp index 10f80e0a..77c77b5d 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Endpoint.hpp @@ -75,23 +75,23 @@ struct Endpoint bool operator ==( const Endpoint& other) const noexcept; - //! Whether the endpoint is currently active - bool active {true}; - - //! Id of participant who discovered this endpoint - ParticipantId discoverer_participant_id {DEFAULT_PARTICIPANT_ID}; + //! Kind of the endpoint + EndpointKind kind {EndpointKind::invalid}; //! Unique id of the endpoint Guid guid {}; - //! Kind of the endpoint - EndpointKind kind {EndpointKind::invalid}; + //! Topic that this endpoint belongs to + DdsTopic topic {}; //! Specific QoS of the entity SpecificEndpointQoS specific_qos {}; - //! Topic that this endpoint belongs to - DdsTopic topic {}; + //! Whether the endpoint is currently active + bool active {true}; + + //! Id of participant who discovered this endpoint + ParticipantId discoverer_participant_id {DEFAULT_PARTICIPANT_ID}; }; /** diff --git a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp index e891d47e..d3be4b83 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/Payload.hpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -31,13 +30,13 @@ namespace ddspipe { namespace core { namespace types { -//! Instance Handler type +//! Change kind using ChangeKind = eprosima::fastdds::rtps::ChangeKind_t; //! Fast DDS Time using DataTime = eprosima::fastdds::rtps::Time_t; -//! Instance Handler type +//! Instance Handle type using InstanceHandle = eprosima::fastdds::rtps::InstanceHandle_t; //! Ownership Strength configuration diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp index 08df14e0..1446037b 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp @@ -40,9 +40,7 @@ struct DynamicTypeData : public core::IRoutingData fastdds::dds::DynamicType::_ref_type dynamic_type{nullptr}; - fastcdr::string_255 type_name{}; - - fastdds::dds::xtypes::TypeIdentifier type_id{}; + fastdds::dds::xtypes::TypeIdentifier type_identifier{}; }; DDSPIPE_CORE_DllAPI diff --git a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp index b86c3a0d..89409de9 100644 --- a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp +++ b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp @@ -89,7 +89,7 @@ struct DdsTopic : public DistributedTopic std::string type_name{}; //! Type Identifiers (complete and minimal) - fastdds::dds::xtypes::TypeIdentifierPair type_ids; + fastdds::dds::xtypes::TypeIdentifierPair type_identifiers; }; } /* namespace types */ diff --git a/ddspipe_core/src/cpp/communication/dds/Track.cpp b/ddspipe_core/src/cpp/communication/dds/Track.cpp index 24ebcdec..efc891e7 100644 --- a/ddspipe_core/src/cpp/communication/dds/Track.cpp +++ b/ddspipe_core/src/cpp/communication/dds/Track.cpp @@ -221,7 +221,7 @@ void Track::transmit_() noexcept std::unique_ptr data; auto ret = reader_->take(data); - if (ret == utils::ReturnCode::NO_DATA) + if (ret == utils::ReturnCode::RETCODE_NO_DATA) { // There is no more data; reduce the status by 1 unsigned int previous_status = data_available_status_.fetch_sub(DataAvailableStatus::transmitting_data); @@ -239,7 +239,7 @@ void Track::transmit_() noexcept continue; } } - else if (ret != utils::ReturnCode::OK) + else if (ret != utils::ReturnCode::RETCODE_OK) { // Error reading data EPROSIMA_LOG_WARNING(DDSPIPE_TRACK, "Error taking data in Track " << topic_->serialize() << ". Error code " << ret @@ -260,7 +260,7 @@ void Track::transmit_() noexcept ret = writer_it.second->write(*data); - if (ret != utils::ReturnCode::OK) + if (ret != utils::ReturnCode::RETCODE_OK) { EPROSIMA_LOG_WARNING( DDSPIPE_TRACK, diff --git a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp index e9659c0c..93927b76 100644 --- a/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp +++ b/ddspipe_core/src/cpp/communication/rpc/RpcBridge.cpp @@ -301,7 +301,7 @@ void RpcBridge::transmit_( // Will never return \c NO_DATA, otherwise would have finished before - if (ret != utils::ReturnCode::OK) + if (ret != utils::ReturnCode::RETCODE_OK) { // Error reading data EPROSIMA_LOG_WARNING(DDSPIPE_RPCBRIDGE, @@ -351,7 +351,7 @@ void RpcBridge::transmit_( ret = request_writers_[service_registry.first]->write(*data); - if (ret != utils::ReturnCode::OK) + if (ret != utils::ReturnCode::RETCODE_OK) { EPROSIMA_LOG_WARNING(DDSPIPE_RPCBRIDGE, "Error writting request in RpcBridge for service " << rpc_topic_ << ". Error code " << ret << @@ -408,7 +408,7 @@ void RpcBridge::transmit_( ret = reply_writers_[registry_entry.first]->write(*data); - if (ret != utils::ReturnCode::OK) + if (ret != utils::ReturnCode::RETCODE_OK) { EPROSIMA_LOG_WARNING(DDSPIPE_RPCBRIDGE, "Error writting reply in RpcBridge for service " << rpc_topic_ << ". Error code " << ret << "."); diff --git a/ddspipe_core/src/cpp/core/DdsPipe.cpp b/ddspipe_core/src/cpp/core/DdsPipe.cpp index b00a6792..5a4eb898 100644 --- a/ddspipe_core/src/cpp/core/DdsPipe.cpp +++ b/ddspipe_core/src/cpp/core/DdsPipe.cpp @@ -14,13 +14,12 @@ #include -#include - -#include #include -#include #include +#include +#include #include +#include #include #include @@ -154,12 +153,12 @@ utils::ReturnCode DdsPipe::enable() noexcept } } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } else { EPROSIMA_LOG_INFO(DDSPIPE, "Trying to enable an already enabled DDS Pipe."); - return utils::ReturnCode::PRECONDITION_NOT_MET; + return utils::ReturnCode::RETCODE_PRECONDITION_NOT_MET; } } @@ -175,12 +174,12 @@ utils::ReturnCode DdsPipe::disable() noexcept deactivate_all_topics_nts_(); - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } else { EPROSIMA_LOG_INFO(DDSPIPE, "Trying to disable a disabled DDS Pipe."); - return utils::ReturnCode::PRECONDITION_NOT_MET; + return utils::ReturnCode::RETCODE_PRECONDITION_NOT_MET; } } @@ -204,7 +203,7 @@ utils::ReturnCode DdsPipe::reload_allowed_topics_( if (*allowed_topics == *allowed_topics_) { logDebug(DDSPIPE, "Same configuration, do nothing in reload."); - return utils::ReturnCode::NO_DATA; + return utils::ReturnCode::RETCODE_NO_DATA; } // Set new Allowed list @@ -214,7 +213,7 @@ utils::ReturnCode DdsPipe::reload_allowed_topics_( if (!enabled_) { - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } // It must change the configuration. Check every topic discovered and activate/deactivate it if needed. @@ -253,7 +252,7 @@ utils::ReturnCode DdsPipe::reload_allowed_topics_( } } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } void DdsPipe::discovered_endpoint_( diff --git a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp index a1823f49..0c7bdab4 100644 --- a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp +++ b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp @@ -206,7 +206,7 @@ utils::ReturnCode DiscoveryDatabase::erase_endpoint_( erased_endpoint_callback(endpoint_to_erase); } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } void DiscoveryDatabase::add_endpoint( diff --git a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp index 142d2bd3..f67b29e0 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/CopyPayloadPool.cpp @@ -32,8 +32,6 @@ bool CopyPayloadPool::get_payload( SerializedPayload_t& payload) { reserve_(size, payload); - payload.max_size = size; - payload.payload_owner = this; return true; } diff --git a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp index faf5ac22..56af6efb 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/FastPayloadPool.cpp @@ -56,7 +56,6 @@ bool FastPayloadPool::get_payload( // Copy info std::memcpy(target_payload.data, src_payload.data, src_payload.length); target_payload.length = src_payload.length; - target_payload.payload_owner = this; } else { diff --git a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp index c401e35b..a04261b8 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp @@ -50,8 +50,6 @@ bool MapPayloadPool::get_payload( { return false; } - payload.max_size = size; - payload.payload_owner = this; // Store this payload in map std::lock_guard lock(reserved_payloads_mutex_); diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index d3e7f08c..2e570b54 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -78,7 +78,7 @@ void PayloadPool::add_release_payload_() bool PayloadPool::reserve_( uint32_t size, - eprosima::fastdds::rtps::SerializedPayload_t& payload) + types::Payload& payload) { if (size == 0) { @@ -89,6 +89,9 @@ bool PayloadPool::reserve_( payload.reserve(size); + payload.max_size = size; + payload.payload_owner = this; + logDebug(DDSPIPE_PAYLOADPOOL, "Reserved payload ptr: " << payload.data << "."); add_reserved_payload_(); @@ -97,11 +100,16 @@ bool PayloadPool::reserve_( } bool PayloadPool::release_( - eprosima::fastdds::rtps::SerializedPayload_t& payload) + types::Payload& payload) { logDebug(DDSPIPE_PAYLOADPOOL, "Releasing payload ptr: " << payload.data << "."); + // Remove payload internal values + payload.length = 0; + payload.max_size = 0; + payload.data = nullptr; payload.payload_owner = nullptr; + payload.pos = 0; payload.empty(); diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp index e691e56c..80ad90c4 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPoolMediator.cpp @@ -33,7 +33,7 @@ PayloadPoolMediator::PayloadPoolMediator( { } -bool PayloadPoolMediator::write( +utils::ReturnCode PayloadPoolMediator::write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data) { @@ -45,7 +45,7 @@ bool PayloadPoolMediator::write( return writer->write(data); } -bool PayloadPoolMediator::write( +utils::ReturnCode PayloadPoolMediator::write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, fastdds::rtps::WriteParams& params) @@ -58,7 +58,7 @@ bool PayloadPoolMediator::write( return writer->write(data, params); } -fastdds::dds::ReturnCode_t PayloadPoolMediator::write( +utils::ReturnCode PayloadPoolMediator::write( fastdds::dds::DataWriter* writer, types::RtpsPayloadData* data, const fastdds::rtps::InstanceHandle_t& handle) diff --git a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp index f0fd7cab..8ebebed5 100644 --- a/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp +++ b/ddspipe_core/src/cpp/logging/DdsLogConsumer.cpp @@ -55,12 +55,6 @@ DdsLogConsumer::DdsLogConsumer( // Register the type fastdds::dds::TypeSupport type(new LogEntryPubSubType()); - if (configuration->publish.publish_type) - { - // Publish the type - type->register_type_object_representation(); - } - type.register_type(participant_); // Create the publisher diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index 5c0c1f87..fa9882f4 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -68,11 +69,12 @@ fastdds::dds::DynamicType::_ref_type container_internal_type( const fastdds::dds::DynamicType::_ref_type& dyn_type) { fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; - const auto ret = dyn_type->get_descriptor(type_descriptor); - if (ret != fastdds::dds::RETCODE_OK) + if (fastdds::dds::RETCODE_OK != dyn_type->get_descriptor(type_descriptor)) { - throw utils::InconsistencyException("No Type Descriptor"); + throw utils::InconsistencyException( + "Failed to get Type Descriptor for type: " + dyn_type->get_name().to_string()); } + return type_descriptor->element_type(); } @@ -80,11 +82,12 @@ fastdds::dds::BoundSeq array_size( const fastdds::dds::DynamicType::_ref_type& dyn_type) { fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; - const auto ret = dyn_type->get_descriptor(type_descriptor); - if (ret != fastdds::dds::RETCODE_OK) + if (fastdds::dds::RETCODE_OK != dyn_type->get_descriptor(type_descriptor)) { - throw utils::InconsistencyException("No Type Descriptor"); + throw utils::InconsistencyException( + "Failed to get Type Descriptor for type: " + dyn_type->get_name().to_string()); } + return type_descriptor->bound(); } @@ -94,17 +97,23 @@ std::vector> get_me std::vector> result; std::map members; - dyn_type->get_all_members(members); + if (fastdds::dds::RETCODE_OK != dyn_type->get_all_members(members)) + { + throw utils::InconsistencyException( + "Failed to get Type Members for type: " + dyn_type->get_name().to_string()); + } for (const auto& member : members) { fastdds::dds::ObjectName dyn_name = member.second->get_name(); + fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; - const auto ret = member.second->get_descriptor(member_descriptor); - if (ret != fastdds::dds::RETCODE_OK) + if (fastdds::dds::RETCODE_OK != member.second->get_descriptor(member_descriptor)) { - throw utils::InconsistencyException("No Member Descriptor"); + throw utils::InconsistencyException( + "Failed to get Type Descriptor of Member with name: " + dyn_name.to_string()); } + result.emplace_back( std::make_pair( utils::demangle_if_ros_type(dyn_name.to_string()), @@ -120,12 +129,15 @@ std::string container_kind_to_str( auto internal_type = container_internal_type(dyn_type); auto this_array_size = array_size(dyn_type); + // TODO: Change assert -> RETCODE + assert(this_array_size.size() == 1); // Multidimensional arrays not supported in ROS2 + std::stringstream ss; ss << type_kind_to_str(internal_type); for (const auto& bound : this_array_size) { - if (bound != fastdds::dds::xtypes::INVALID_LBOUND) + if (bound != static_cast(fastdds::dds::LENGTH_UNLIMITED)) { if (allow_bounded) { @@ -156,6 +168,9 @@ std::string type_kind_to_str( case fastdds::dds::xtypes::TK_BYTE: return "uint8"; + case fastdds::dds::xtypes::TK_INT8: + return "int8"; + case fastdds::dds::xtypes::TK_INT16: return "int16"; @@ -165,6 +180,9 @@ std::string type_kind_to_str( case fastdds::dds::xtypes::TK_INT64: return "int64"; + case fastdds::dds::xtypes::TK_UINT8: + return "uint8"; + case fastdds::dds::xtypes::TK_UINT16: return "uint16"; @@ -180,9 +198,6 @@ std::string type_kind_to_str( case fastdds::dds::xtypes::TK_FLOAT64: return "float64"; - case fastdds::dds::xtypes::TK_CHAR8: - return "int8"; - case fastdds::dds::xtypes::TK_STRING8: return "string"; @@ -196,6 +211,7 @@ std::string type_kind_to_str( return utils::demangle_if_ros_type((dyn_type->get_name()).to_string()); case fastdds::dds::xtypes::TK_FLOAT128: + case fastdds::dds::xtypes::TK_CHAR8: case fastdds::dds::xtypes::TK_CHAR16: case fastdds::dds::xtypes::TK_STRING16: case fastdds::dds::xtypes::TK_ENUM: diff --git a/ddspipe_core/src/cpp/types/dynamic_types/types.cpp b/ddspipe_core/src/cpp/types/dynamic_types/types.cpp index 0361b876..93c87cb0 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/types.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/types.cpp @@ -16,9 +16,8 @@ * @file types.cpp */ -#include - #include +#include namespace eprosima { namespace ddspipe { diff --git a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp index 346e4d18..11e5c4fd 100644 --- a/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp +++ b/ddspipe_core/src/cpp/types/topic/dds/DdsTopic.cpp @@ -121,7 +121,7 @@ DdsTopic& DdsTopic::operator = ( Topic::operator =(other); this->type_name = other.type_name; - this->type_ids = other.type_ids; + this->type_identifiers = other.type_identifiers; return *this; } diff --git a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp index 4e14ed8d..85d507d7 100644 --- a/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/FastPayloadPoolTest.cpp @@ -67,8 +67,6 @@ void get_release( FastPayloadPool& pool, Payload& src_payload) { - eprosima::fastdds::rtps::IPayloadPool* payload_owner = - static_cast(&pool); Payload dst_payload; ASSERT_TRUE(pool.get_payload(src_payload, dst_payload)); ASSERT_TRUE(pool.release_payload(dst_payload)); diff --git a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp index 10d4dd0a..3ca5a897 100644 --- a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp @@ -51,15 +51,15 @@ class MockMapPayloadPool : public MapPayloadPool } uint64_t reference_count( - const fastdds::rtps::SerializedPayload_t& payload) + const types::Payload& payload) { return reserved_payloads_[payload.data]; } void clean_all( - std::vector& payloads) + std::vector& payloads) { - for (fastdds::rtps::SerializedPayload_t& payload : payloads) + for (types::Payload& payload : payloads) { release_payload(payload); } @@ -88,7 +88,7 @@ TEST(MapPayloadPoolTest, get_payload) // Get N different pointers { test::MockMapPayloadPool pool; - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); for (unsigned int i = 0; i < TEST_NUMBER; i++) { @@ -106,7 +106,7 @@ TEST(MapPayloadPoolTest, get_payload) // fail reserve memory { test::MockMapPayloadPool pool; - eprosima::fastdds::rtps::SerializedPayload_t payload; + eprosima::ddspipe::core::types::Payload payload; ASSERT_FALSE(pool.get_payload(0, payload)); } @@ -127,15 +127,15 @@ TEST(MapPayloadPoolTest, get_payload) */ TEST(MapPayloadPoolTest, get_payload_from_src) { - eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload + eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); test::MockMapPayloadPool* pool_ = static_cast(pool); - eprosima::fastdds::rtps::SerializedPayload_t payload0; - eprosima::fastdds::rtps::SerializedPayload_t payload1; - eprosima::fastdds::rtps::SerializedPayload_t payload2; - eprosima::fastdds::rtps::SerializedPayload_t payload3; - eprosima::fastdds::rtps::SerializedPayload_t payload4; - eprosima::fastdds::rtps::SerializedPayload_t payload5; + eprosima::ddspipe::core::types::Payload payload0; + eprosima::ddspipe::core::types::Payload payload1; + eprosima::ddspipe::core::types::Payload payload2; + eprosima::ddspipe::core::types::Payload payload3; + eprosima::ddspipe::core::types::Payload payload4; + eprosima::ddspipe::core::types::Payload payload5; // get payload0 ASSERT_TRUE(pool_->get_payload(DEFAULT_SIZE, payload0)); @@ -214,8 +214,8 @@ TEST(MapPayloadPoolTest, get_payload_from_src_no_owner) eprosima::fastdds::rtps::IPayloadPool* pool_aux = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_aux_ = static_cast(pool_aux); - eprosima::fastdds::rtps::SerializedPayload_t payload_src; - eprosima::fastdds::rtps::SerializedPayload_t payload_target; + eprosima::ddspipe::core::types::Payload payload_src; + eprosima::ddspipe::core::types::Payload payload_target; // get payload aux from pool aux pool_aux_->get_payload(DEFAULT_SIZE, payload_src); @@ -253,8 +253,8 @@ TEST(MapPayloadPoolTest, get_payload_from_src_negative) test::MockMapPayloadPool* pool_ = static_cast(pool); eprosima::fastdds::rtps::IPayloadPool* pool_aux = nullptr; // nullptr - eprosima::fastdds::rtps::SerializedPayload_t payload_src; - eprosima::fastdds::rtps::SerializedPayload_t payload_target; + eprosima::ddspipe::core::types::Payload payload_src; + eprosima::ddspipe::core::types::Payload payload_target; ASSERT_FALSE( pool_->get_payload( @@ -279,7 +279,7 @@ TEST(MapPayloadPoolTest, release_payload) { eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); // get first payload pool_->get_payload(DEFAULT_SIZE, payloads[0]); @@ -332,7 +332,7 @@ TEST(MapPayloadPoolTest, release_payload_negative) test::MockMapPayloadPool pool; test::MockMapPayloadPool pool_aux; - eprosima::fastdds::rtps::SerializedPayload_t payload; + eprosima::ddspipe::core::types::Payload payload; pool_aux.get_payload(DEFAULT_SIZE, payload); diff --git a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp index 55cbbadb..dad9b66d 100644 --- a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp @@ -319,154 +319,15 @@ TEST(PayloadPoolTest, is_clean) ASSERT_TRUE(pool.is_clean()); // reserve and not clean - eprosima::fastdds::rtps::CacheChange_t cc; - pool.reserve_(sizeof(PayloadUnit), cc.serializedPayload); + Payload payload; + pool.reserve_(sizeof(PayloadUnit), payload); ASSERT_FALSE(pool.is_clean()); // release and clean - pool.release_(cc.serializedPayload); + pool.release_(payload); ASSERT_TRUE(pool.is_clean()); } -// /** -// * Test get_payload cache_change fails if the child class fails -// * -// * CASES: -// * - get_payload for payload goes ok -// * - get_payload for payload fails -// */ -// TEST(PayloadPoolTest, get_payload_cache_change) -// { -// // get_payload for payload goes ok -// { -// test::MockPayloadPool pool; -// eprosima::fastdds::rtps::CacheChange_t cc; - -// EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(true)); - -// EXPECT_TRUE(pool.get_payload(sizeof(PayloadUnit), cc)); - -// // Clean cache change correctly so process dont break -// cc.payload_owner(nullptr); -// } - -// // get_payload for payload goes ok -// { -// test::MockPayloadPool pool; -// eprosima::fastdds::rtps::CacheChange_t cc; - -// EXPECT_CALL(pool, get_payload(_, _)).Times(1).WillOnce(Return(false)); - -// EXPECT_FALSE(pool.get_payload(sizeof(PayloadUnit), cc)); -// } -// } - -// /** -// * Test get_payload cache_change with source fails if the child class fails -// * -// * CASES: -// * - get_payload for payload goes ok -// * - get_payload for payload fails -// */ -// TEST(PayloadPoolTest, get_payload_from_src_cache_change) -// { -// // get_payload for payload goes ok -// { -// test::MockPayloadPool pool; -// eprosima::fastdds::rtps::CacheChange_t target; -// Payload source; -// eprosima::fastdds::rtps::IPayloadPool* aux_pool; - -// EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(true)); - -// EXPECT_TRUE(pool.get_payload(source, aux_pool, target)); - -// // Clean cache change correctly so process dont break -// target.payload_owner(nullptr); -// } -// } - -// /** -// * Test get_payload cache_change with source fails if the child class fails -// * -// * CASES: -// * - get_payload for payload fails -// */ -// TEST(PayloadPoolTest, get_payload_from_src_cache_change_negative) -// { -// // get_payload for payload fails -// { -// test::MockPayloadPool pool; -// eprosima::fastdds::rtps::CacheChange_t target; -// Payload source; -// eprosima::fastdds::rtps::IPayloadPool* aux_pool; - -// EXPECT_CALL(pool, get_payload(_, _, _)).Times(1).WillOnce(Return(false)); - -// EXPECT_FALSE(pool.get_payload(source, aux_pool, target)); -// } -// } - -// /** -// * Test release_payload cache_change method using MockPayloadPool when inside get_payload method fails -// * -// * CASES: -// * different ownership -// * this ownership release ok -// */ -// TEST(PayloadPoolTest, release_payload_cache_change) -// { -// // this ownership release ok -// { -// test::MockPayloadPool pool; -// eprosima::fastdds::rtps::CacheChange_t cc; - -// // ownership must be this pool -// cc.payload_owner(&pool); - -// EXPECT_CALL(pool, release_payload(_)).Times(1).WillOnce(Return(true)); - -// EXPECT_TRUE(pool.release_payload(cc)); -// } -// } - -// /** -// * Test release_payload cache_change method from a different owner -// * -// * CASES: -// * this ownership release fail -// */ -// TEST(PayloadPoolTest, release_payload_cache_change_negative) -// { -// // different ownership -// { -// // 1 log error expected -// INSTANTIATE_LOG_TESTER(eprosima::utils::Log::Kind::Error, 1, 1); - -// test::MockPayloadPool pool; -// eprosima::fastdds::rtps::CacheChange_t cc; -// cc.payload_owner(nullptr); - -// EXPECT_THROW(pool.release_payload(cc), eprosima::utils::InconsistencyException); -// } - -// // this ownership release fail -// { -// test::MockPayloadPool pool; -// eprosima::fastdds::rtps::CacheChange_t cc; - -// // ownership must be this pool -// cc.payload_owner(&pool); - -// EXPECT_CALL(pool, release_payload(_)).Times(1).WillOnce(Return(false)); - -// EXPECT_FALSE(pool.release_payload(cc)); - -// // Clean cache change correctly so process dont break -// cc.payload_owner(nullptr); -// } -// } - int main( int argc, char** argv) diff --git a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp index 9cd2b3dd..86c794a4 100644 --- a/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp +++ b/ddspipe_core/test/unittest/logging/dds_consumer/DdsLogConsumerTest.cpp @@ -97,9 +97,9 @@ class DdsLogConsumerTest : public testing::Test * Test that the DdsLogConsumer publishes logs when publish::enable is set to true. * * CASES: - * - check that the DdsLogConsumer publishes EPROSIMA_LOG_INFOs. - * - check that the DdsLogConsumer publishes EPROSIMA_LOG_WARNINGs. - * - check that the DdsLogConsumer publishes EPROSIMA_LOG_ERRORs. + * - check that the DdsLogConsumer publishes log info traces. + * - check that the DdsLogConsumer publishes log warning traces. + * - check that the DdsLogConsumer publishes log error traces. */ TEST_F(DdsLogConsumerTest, publish_logs) { @@ -191,9 +191,9 @@ TEST_F(DdsLogConsumerTest, publish_logs) * Test that the DdsLogConsumer doesn't publish when publish::enable is set to false. * * CASES: - * - check that the DdsLogConsumer doesn't publish EPROSIMA_LOG_INFOs. - * - check that the DdsLogConsumer doesn't publish EPROSIMA_LOG_WARNINGs. - * - check that the DdsLogConsumer doesn't publish EPROSIMA_LOG_ERRORs. + * - check that the DdsLogConsumer doesn't publish log info traces. + * - check that the DdsLogConsumer doesn't publish log warning traces. + * - check that the DdsLogConsumer doesn't publish log error traces. */ TEST_F(DdsLogConsumerTest, dont_publish_logs) { diff --git a/ddspipe_core/test/unittest/types/CMakeLists.txt b/ddspipe_core/test/unittest/types/CMakeLists.txt index 6fbb0b16..94acaa2b 100644 --- a/ddspipe_core/test/unittest/types/CMakeLists.txt +++ b/ddspipe_core/test/unittest/types/CMakeLists.txt @@ -12,5 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. +add_subdirectory(dynamic_types) add_subdirectory(endpoint) add_subdirectory(topic) diff --git a/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt b/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt new file mode 100644 index 00000000..5a129e9b --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt @@ -0,0 +1,57 @@ +# Copyright 2021 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. + +#################### +# dtypes_msg_tests # +#################### + +set(TEST_NAME dtypes_msg_tests) + +# Add to test sources every FastDDSGen file generated +file(GLOB DATATYPE_SOURCES_CXX "types/**/*.cxx") +set(TEST_SOURCES + dtypes_msg_tests.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/types/dynamic_types/schema_msg.cpp + ${DATATYPE_SOURCES_CXX} + ) + +set(TEST_LIST + ) + +set(TEST_EXTRA_LIBRARIES + fastcdr + fastdds + cpp_utils + $<$:iphlpapi$Shlwapi> + ) + +# Add to needed sources every .msg file +file( + GLOB + RESULT_SOURCES_MSG + RELATIVE + "${CMAKE_CURRENT_SOURCE_DIR}" + "types/msgs/*.msg") + +set(TEST_NEEDED_SOURCES + ${RESULT_SOURCES_MSG} + ) + +add_unittest_executable( + "${TEST_NAME}" + "${TEST_SOURCES}" + "${TEST_LIST}" + "${TEST_EXTRA_LIBRARIES}" + "${TEST_NEEDED_SOURCES}" + ) diff --git a/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp new file mode 100644 index 00000000..c73e0429 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/dtypes_msg_tests.cpp @@ -0,0 +1,111 @@ +// Copyright 2023 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. + +#include + +#include + +#include +#include +#include + +#include + +#include + +#include "types/all_types.hpp" + +using namespace eprosima; + +namespace test { + +std::string read_msg_from_file_( + const std::string& file_name) +{ + return utils::file_to_string(file_name.c_str()); +} + +std::string file_name_by_type( + SupportedType type) +{ + return std::string("types/msgs/") + to_string(type) + ".msg"; +} + +void compare_schemas( + const std::string& schema1, + const std::string& schema2) +{ + ASSERT_EQ(schema1, schema2); +} + +void execute_test_by_type( + SupportedType type) +{ + // Get msg file in string with the value expected to be generated in the schema + std::string msg_file = read_msg_from_file_(file_name_by_type(type)); + + // Register TypeObject representation + register_type_object_representation(type); + + // Get Dynamic type + fastdds::dds::DynamicType::_ref_type dyn_type; + get_dynamic_type(type, dyn_type); + + // Get schema generated + std::string schema = ddspipe::core::types::msg::generate_ros2_schema(dyn_type); + + // Compare schemas + compare_schemas(msg_file, schema); +} + +} // namespace test + +class ParametrizedTests : public ::testing::TestWithParam +{ +public: + + void SetUp() + { + type_ = GetParam(); + } + + test::SupportedType type_; +}; + +/** + * TODO + */ +TEST_P(ParametrizedTests, msg_schema_generation) +{ + test::execute_test_by_type(type_); +} + +INSTANTIATE_TEST_SUITE_P(dtypes_msg_tests, ParametrizedTests, ::testing::Values( + test::SupportedType::hello_world, + test::SupportedType::numeric_array, + test::SupportedType::char_sequence, + test::SupportedType::basic_struct, + test::SupportedType::basic_array_struct, + test::SupportedType::float_bounded_sequence, + test::SupportedType::arrays_and_sequences, + test::SupportedType::complex_nested_arrays + )); + +int main( + int argc, + char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp new file mode 100644 index 00000000..08063da0 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/all_types.hpp @@ -0,0 +1,141 @@ +// Copyright 2022 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 all_types.hpp + */ + +/* + * USEFUL COMMAND + * + * for TYPE in hello_world numeric_array char_sequence basic_struct basic_array_struct float_bounded_sequence arrays_and_sequences complex_nested_arrays; do ${FASTDDSGEN_WS}/scripts/fastddsgen -replace -d ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/type_objects/ -typeobject -cs ${WS}/src/recorder/ddsrecorder/test/unittest/dynamic_types/types/idls/${TYPE}.idl; done + */ + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "type_objects/arrays_and_sequences.hpp" +#include "type_objects/arrays_and_sequencesPubSubTypes.hpp" + +#include "type_objects/basic_array_struct.hpp" +#include "type_objects/basic_array_structPubSubTypes.hpp" + +#include "type_objects/basic_struct.hpp" +#include "type_objects/basic_structPubSubTypes.hpp" + +#include "type_objects/char_sequence.hpp" +#include "type_objects/char_sequencePubSubTypes.hpp" + +#include "type_objects/complex_nested_arrays.hpp" +#include "type_objects/complex_nested_arraysPubSubTypes.hpp" + +#include "type_objects/float_bounded_sequence.hpp" +#include "type_objects/float_bounded_sequencePubSubTypes.hpp" + +#include "type_objects/hello_world.hpp" +#include "type_objects/hello_worldPubSubTypes.hpp" + +#include "type_objects/numeric_array.hpp" +#include "type_objects/numeric_arrayPubSubTypes.hpp" + +namespace test { + +ENUMERATION_BUILDER( + SupportedType, + hello_world, + numeric_array, + char_sequence, + basic_struct, + basic_array_struct, + float_bounded_sequence, + arrays_and_sequences, + complex_nested_arrays, + ); + +void register_type_object_representation( + const SupportedType& type) +{ + using namespace eprosima::fastdds::dds; + + TypeSupport type_support; + + if (type == SupportedType::arrays_and_sequences) + { + type_support.reset(new arrays_and_sequencesPubSubType()); + } + else if (type == SupportedType::basic_array_struct) + { + type_support.reset(new basic_array_structPubSubType()); + } + else if (type == SupportedType::basic_struct) + { + type_support.reset(new basic_structPubSubType()); + } + else if (type == SupportedType::char_sequence) + { + type_support.reset(new char_sequencePubSubType()); + } + else if (type == SupportedType::complex_nested_arrays) + { + type_support.reset(new complex_nested_arraysPubSubType()); + } + else if (type == SupportedType::float_bounded_sequence) + { + type_support.reset(new float_bounded_sequencePubSubType()); + } + else if (type == SupportedType::hello_world) + { + type_support.reset(new hello_worldPubSubType()); + } + else if (type == SupportedType::numeric_array) + { + type_support.reset(new numeric_arrayPubSubType()); + } + else + { + ASSERT_FALSE(true) << "Type not supported"; + } + + type_support->register_type_object_representation(); +} + +void get_dynamic_type( + const SupportedType& type, + eprosima::fastdds::dds::DynamicType::_ref_type& dyn_type) +{ + auto type_name = to_string(type); + + // Find TypeObjects for the type + eprosima::fastdds::dds::xtypes::TypeObjectPair type_objs; + ASSERT_EQ(eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_objects( + type_name, type_objs), + eprosima::fastdds::dds::RETCODE_OK); + + // Create DynamicType from TypeObject + dyn_type = eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( + type_objs.complete_type_object)->build(); +} + +} /* namespace test */ diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl new file mode 100644 index 00000000..5d9f9819 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/arrays_and_sequences.idl @@ -0,0 +1,12 @@ +struct AnInternalObject +{ + float x; + boolean positive; +}; + +struct arrays_and_sequences +{ + sequence unlimited_vector; + sequence limited_vector; + AnInternalObject limited_array[10]; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl new file mode 100644 index 00000000..b81e5956 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_array_struct.idl @@ -0,0 +1,11 @@ +struct TheOtherObjectInArray +{ + long some_num; + boolean positive; +}; + +struct basic_array_struct +{ + unsigned long index; + TheOtherObjectInArray sub_structs[5]; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl new file mode 100644 index 00000000..da2ea1bb --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/basic_struct.idl @@ -0,0 +1,9 @@ +struct TheOtherObject +{ + long some_num; +}; + +struct basic_struct +{ + TheOtherObject sub_struct; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl new file mode 100644 index 00000000..0abf7dd8 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/char_sequence.idl @@ -0,0 +1,4 @@ +struct char_sequence +{ + sequence chars; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl new file mode 100644 index 00000000..b4eca21b --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/complex_nested_arrays.idl @@ -0,0 +1,23 @@ +struct ThirdLevelElement +{ + double x; + double y; +}; + +struct SecondLevelElement +{ + ThirdLevelElement an_element_alone; + sequence a_limited_other_value; +}; + +struct FirstLevelElement +{ + string useless_name; + sequence sub; + ThirdLevelElement an_element_alone; +}; + +struct complex_nested_arrays +{ + FirstLevelElement array_of_elements[3]; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl new file mode 100644 index 00000000..b297df86 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/float_bounded_sequence.idl @@ -0,0 +1,4 @@ +struct float_bounded_sequence +{ + sequence numbers; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl new file mode 100644 index 00000000..d82036d8 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/hello_world.idl @@ -0,0 +1,5 @@ +struct hello_world +{ + unsigned long index; + string message; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl new file mode 100644 index 00000000..814abd59 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/idls/numeric_array.idl @@ -0,0 +1,4 @@ +struct numeric_array +{ + long points[3]; +}; diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg new file mode 100644 index 00000000..1942bc58 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/arrays_and_sequences.msg @@ -0,0 +1,7 @@ +AnInternalObject[] unlimited_vector +AnInternalObject[<=10] limited_vector +AnInternalObject[10] limited_array +================================================================================ +MSG: fastdds/AnInternalObject +float32 x +bool positive diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg new file mode 100644 index 00000000..a012398a --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_array_struct.msg @@ -0,0 +1,6 @@ +uint32 index +TheOtherObjectInArray[5] sub_structs +================================================================================ +MSG: fastdds/TheOtherObjectInArray +int32 some_num +bool positive diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg new file mode 100644 index 00000000..eb9814cb --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/basic_struct.msg @@ -0,0 +1,4 @@ +TheOtherObject sub_struct +================================================================================ +MSG: fastdds/TheOtherObject +int32 some_num diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg new file mode 100644 index 00000000..bf4b2456 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg @@ -0,0 +1 @@ +int8[] chars diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg new file mode 100644 index 00000000..5eebc2f4 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/complex_nested_arrays.msg @@ -0,0 +1,14 @@ +FirstLevelElement[3] array_of_elements +================================================================================ +MSG: fastdds/ThirdLevelElement +float64 x +float64 y +================================================================================ +MSG: fastdds/SecondLevelElement +ThirdLevelElement an_element_alone +ThirdLevelElement[<=1] a_limited_other_value +================================================================================ +MSG: fastdds/FirstLevelElement +string useless_name +SecondLevelElement[] sub +ThirdLevelElement an_element_alone diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg new file mode 100644 index 00000000..77503c2e --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/float_bounded_sequence.msg @@ -0,0 +1 @@ +float32[<=13] numbers diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg new file mode 100644 index 00000000..63e3fbcb --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/hello_world.msg @@ -0,0 +1,2 @@ +uint32 index +string message diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg new file mode 100644 index 00000000..d391c85d --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/numeric_array.msg @@ -0,0 +1 @@ +int32[3] points diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp new file mode 100644 index 00000000..e94655a4 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequences.hpp @@ -0,0 +1,445 @@ +// 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 arrays_and_sequences.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_HPP + +#include +#include +#include +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(ARRAYS_AND_SEQUENCES_SOURCE) +#define ARRAYS_AND_SEQUENCES_DllAPI __declspec( dllexport ) +#else +#define ARRAYS_AND_SEQUENCES_DllAPI __declspec( dllimport ) +#endif // ARRAYS_AND_SEQUENCES_SOURCE +#else +#define ARRAYS_AND_SEQUENCES_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define ARRAYS_AND_SEQUENCES_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure AnInternalObject defined by the user in the IDL file. + * @ingroup arrays_and_sequences + */ +class AnInternalObject +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport AnInternalObject() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~AnInternalObject() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object AnInternalObject that will be copied. + */ + eProsima_user_DllExport AnInternalObject( + const AnInternalObject& x) + { + m_x = x.m_x; + + m_positive = x.m_positive; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object AnInternalObject that will be copied. + */ + eProsima_user_DllExport AnInternalObject( + AnInternalObject&& x) noexcept + { + m_x = x.m_x; + m_positive = x.m_positive; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object AnInternalObject that will be copied. + */ + eProsima_user_DllExport AnInternalObject& operator =( + const AnInternalObject& x) + { + + m_x = x.m_x; + + m_positive = x.m_positive; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object AnInternalObject that will be copied. + */ + eProsima_user_DllExport AnInternalObject& operator =( + AnInternalObject&& x) noexcept + { + + m_x = x.m_x; + m_positive = x.m_positive; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x AnInternalObject object to compare. + */ + eProsima_user_DllExport bool operator ==( + const AnInternalObject& x) const + { + return (m_x == x.m_x && + m_positive == x.m_positive); + } + + /*! + * @brief Comparison operator. + * @param x AnInternalObject object to compare. + */ + eProsima_user_DllExport bool operator !=( + const AnInternalObject& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member x + * @param _x New value for member x + */ + eProsima_user_DllExport void x( + float _x) + { + m_x = _x; + } + + /*! + * @brief This function returns the value of member x + * @return Value of member x + */ + eProsima_user_DllExport float x() const + { + return m_x; + } + + /*! + * @brief This function returns a reference to member x + * @return Reference to member x + */ + eProsima_user_DllExport float& x() + { + return m_x; + } + + + /*! + * @brief This function sets a value in member positive + * @param _positive New value for member positive + */ + eProsima_user_DllExport void positive( + bool _positive) + { + m_positive = _positive; + } + + /*! + * @brief This function returns the value of member positive + * @return Value of member positive + */ + eProsima_user_DllExport bool positive() const + { + return m_positive; + } + + /*! + * @brief This function returns a reference to member positive + * @return Reference to member positive + */ + eProsima_user_DllExport bool& positive() + { + return m_positive; + } + + + +private: + + float m_x{0.0}; + bool m_positive{false}; + +}; +/*! + * @brief This class represents the structure arrays_and_sequences defined by the user in the IDL file. + * @ingroup arrays_and_sequences + */ +class arrays_and_sequences +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport arrays_and_sequences() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~arrays_and_sequences() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object arrays_and_sequences that will be copied. + */ + eProsima_user_DllExport arrays_and_sequences( + const arrays_and_sequences& x) + { + m_unlimited_vector = x.m_unlimited_vector; + + m_limited_vector = x.m_limited_vector; + + m_limited_array = x.m_limited_array; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object arrays_and_sequences that will be copied. + */ + eProsima_user_DllExport arrays_and_sequences( + arrays_and_sequences&& x) noexcept + { + m_unlimited_vector = std::move(x.m_unlimited_vector); + m_limited_vector = std::move(x.m_limited_vector); + m_limited_array = std::move(x.m_limited_array); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object arrays_and_sequences that will be copied. + */ + eProsima_user_DllExport arrays_and_sequences& operator =( + const arrays_and_sequences& x) + { + + m_unlimited_vector = x.m_unlimited_vector; + + m_limited_vector = x.m_limited_vector; + + m_limited_array = x.m_limited_array; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object arrays_and_sequences that will be copied. + */ + eProsima_user_DllExport arrays_and_sequences& operator =( + arrays_and_sequences&& x) noexcept + { + + m_unlimited_vector = std::move(x.m_unlimited_vector); + m_limited_vector = std::move(x.m_limited_vector); + m_limited_array = std::move(x.m_limited_array); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x arrays_and_sequences object to compare. + */ + eProsima_user_DllExport bool operator ==( + const arrays_and_sequences& x) const + { + return (m_unlimited_vector == x.m_unlimited_vector && + m_limited_vector == x.m_limited_vector && + m_limited_array == x.m_limited_array); + } + + /*! + * @brief Comparison operator. + * @param x arrays_and_sequences object to compare. + */ + eProsima_user_DllExport bool operator !=( + const arrays_and_sequences& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member unlimited_vector + * @param _unlimited_vector New value to be copied in member unlimited_vector + */ + eProsima_user_DllExport void unlimited_vector( + const std::vector& _unlimited_vector) + { + m_unlimited_vector = _unlimited_vector; + } + + /*! + * @brief This function moves the value in member unlimited_vector + * @param _unlimited_vector New value to be moved in member unlimited_vector + */ + eProsima_user_DllExport void unlimited_vector( + std::vector&& _unlimited_vector) + { + m_unlimited_vector = std::move(_unlimited_vector); + } + + /*! + * @brief This function returns a constant reference to member unlimited_vector + * @return Constant reference to member unlimited_vector + */ + eProsima_user_DllExport const std::vector& unlimited_vector() const + { + return m_unlimited_vector; + } + + /*! + * @brief This function returns a reference to member unlimited_vector + * @return Reference to member unlimited_vector + */ + eProsima_user_DllExport std::vector& unlimited_vector() + { + return m_unlimited_vector; + } + + + /*! + * @brief This function copies the value in member limited_vector + * @param _limited_vector New value to be copied in member limited_vector + */ + eProsima_user_DllExport void limited_vector( + const std::vector& _limited_vector) + { + m_limited_vector = _limited_vector; + } + + /*! + * @brief This function moves the value in member limited_vector + * @param _limited_vector New value to be moved in member limited_vector + */ + eProsima_user_DllExport void limited_vector( + std::vector&& _limited_vector) + { + m_limited_vector = std::move(_limited_vector); + } + + /*! + * @brief This function returns a constant reference to member limited_vector + * @return Constant reference to member limited_vector + */ + eProsima_user_DllExport const std::vector& limited_vector() const + { + return m_limited_vector; + } + + /*! + * @brief This function returns a reference to member limited_vector + * @return Reference to member limited_vector + */ + eProsima_user_DllExport std::vector& limited_vector() + { + return m_limited_vector; + } + + + /*! + * @brief This function copies the value in member limited_array + * @param _limited_array New value to be copied in member limited_array + */ + eProsima_user_DllExport void limited_array( + const std::array& _limited_array) + { + m_limited_array = _limited_array; + } + + /*! + * @brief This function moves the value in member limited_array + * @param _limited_array New value to be moved in member limited_array + */ + eProsima_user_DllExport void limited_array( + std::array&& _limited_array) + { + m_limited_array = std::move(_limited_array); + } + + /*! + * @brief This function returns a constant reference to member limited_array + * @return Constant reference to member limited_array + */ + eProsima_user_DllExport const std::array& limited_array() const + { + return m_limited_array; + } + + /*! + * @brief This function returns a reference to member limited_array + * @return Reference to member limited_array + */ + eProsima_user_DllExport std::array& limited_array() + { + return m_limited_array; + } + + + +private: + + std::vector m_unlimited_vector; + std::vector m_limited_vector; + std::array m_limited_array; + +}; + +#endif // _FAST_DDS_GENERATED_ARRAYS_AND_SEQUENCES_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp new file mode 100644 index 00000000..d777ee1c --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.hpp @@ -0,0 +1,53 @@ +// 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 arrays_and_sequencesCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP + +#include "arrays_and_sequences.hpp" + +constexpr uint32_t arrays_and_sequences_max_cdr_typesize {261UL}; +constexpr uint32_t arrays_and_sequences_max_key_cdr_typesize {0UL}; + +constexpr uint32_t AnInternalObject_max_cdr_typesize {9UL}; +constexpr uint32_t AnInternalObject_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const AnInternalObject& data); + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const arrays_and_sequences& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp new file mode 100644 index 00000000..a4a8d321 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesCdrAux.ipp @@ -0,0 +1,230 @@ +// 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 arrays_and_sequencesCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP + +#include "arrays_and_sequencesCdrAux.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 AnInternalObject& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.x(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.positive(), 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 AnInternalObject& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.x() + << eprosima::fastcdr::MemberId(1) << data.positive() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + AnInternalObject& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.x(); + break; + + case 1: + dcdr >> data.positive(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const AnInternalObject& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.x(); + + scdr << data.positive(); + +} + + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const arrays_and_sequences& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.unlimited_vector(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.limited_vector(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), + data.limited_array(), 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 arrays_and_sequences& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.unlimited_vector() + << eprosima::fastcdr::MemberId(1) << data.limited_vector() + << eprosima::fastcdr::MemberId(2) << data.limited_array() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + arrays_and_sequences& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.unlimited_vector(); + break; + + case 1: + dcdr >> data.limited_vector(); + break; + + case 2: + dcdr >> data.limited_array(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const arrays_and_sequences& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.unlimited_vector(); + + scdr << data.limited_vector(); + + scdr << data.limited_array(); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCESCDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx new file mode 100644 index 00000000..27b3d723 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.cxx @@ -0,0 +1,398 @@ +// 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 arrays_and_sequencesPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "arrays_and_sequencesPubSubTypes.hpp" + +#include +#include + +#include "arrays_and_sequencesCdrAux.hpp" +#include "arrays_and_sequencesTypeObjectSupport.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; + +AnInternalObjectPubSubType::AnInternalObjectPubSubType() +{ + set_name("AnInternalObject"); + uint32_t type_size = AnInternalObject_max_cdr_typesize; + 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; + uint32_t key_length = AnInternalObject_max_key_cdr_typesize > 16 ? AnInternalObject_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +AnInternalObjectPubSubType::~AnInternalObjectPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool AnInternalObjectPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const AnInternalObject* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool AnInternalObjectPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + AnInternalObject* 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; +} + +uint32_t AnInternalObjectPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* AnInternalObjectPubSubType::create_data() +{ + return reinterpret_cast(new AnInternalObject()); +} + +void AnInternalObjectPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool AnInternalObjectPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + AnInternalObject data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool AnInternalObjectPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const AnInternalObject* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + AnInternalObject_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || AnInternalObject_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void AnInternalObjectPubSubType::register_type_object_representation() +{ + register_AnInternalObject_type_identifier(type_identifiers_); +} + +arrays_and_sequencesPubSubType::arrays_and_sequencesPubSubType() +{ + set_name("arrays_and_sequences"); + uint32_t type_size = arrays_and_sequences_max_cdr_typesize; + 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; + uint32_t key_length = arrays_and_sequences_max_key_cdr_typesize > 16 ? arrays_and_sequences_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +arrays_and_sequencesPubSubType::~arrays_and_sequencesPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool arrays_and_sequencesPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const arrays_and_sequences* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool arrays_and_sequencesPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + arrays_and_sequences* 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; +} + +uint32_t arrays_and_sequencesPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* arrays_and_sequencesPubSubType::create_data() +{ + return reinterpret_cast(new arrays_and_sequences()); +} + +void arrays_and_sequencesPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool arrays_and_sequencesPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + arrays_and_sequences data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool arrays_and_sequencesPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const arrays_and_sequences* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + arrays_and_sequences_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || arrays_and_sequences_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void arrays_and_sequencesPubSubType::register_type_object_representation() +{ + register_arrays_and_sequences_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "arrays_and_sequencesCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp new file mode 100644 index 00000000..f6cb7c3c --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesPubSubTypes.hpp @@ -0,0 +1,204 @@ +// 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 arrays_and_sequencesPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "arrays_and_sequences.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated arrays_and_sequences is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type AnInternalObject defined by the user in the IDL file. + * @ingroup arrays_and_sequences + */ +class AnInternalObjectPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef AnInternalObject type; + + eProsima_user_DllExport AnInternalObjectPubSubType(); + + eProsima_user_DllExport ~AnInternalObjectPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type arrays_and_sequences defined by the user in the IDL file. + * @ingroup arrays_and_sequences + */ +class arrays_and_sequencesPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef arrays_and_sequences type; + + eProsima_user_DllExport arrays_and_sequencesPubSubType(); + + eProsima_user_DllExport ~arrays_and_sequencesPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx new file mode 100644 index 00000000..06defd21 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.cxx @@ -0,0 +1,341 @@ +// 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 arrays_and_sequencesTypeObjectSupport.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. + */ + +#include "arrays_and_sequencesTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "arrays_and_sequences.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_AnInternalObject_type_identifier( + TypeIdentifierPair& type_ids_AnInternalObject) +{ + + ReturnCode_t return_code_AnInternalObject {eprosima::fastdds::dds::RETCODE_OK}; + return_code_AnInternalObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_AnInternalObject); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_AnInternalObject) + { + StructTypeFlag struct_flags_AnInternalObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_AnInternalObject = "AnInternalObject"; + eprosima::fastcdr::optional type_ann_builtin_AnInternalObject; + eprosima::fastcdr::optional ann_custom_AnInternalObject; + CompleteTypeDetail detail_AnInternalObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_AnInternalObject, ann_custom_AnInternalObject, type_name_AnInternalObject.to_string()); + CompleteStructHeader header_AnInternalObject; + header_AnInternalObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_AnInternalObject); + CompleteStructMemberSeq member_seq_AnInternalObject; + { + TypeIdentifierPair type_ids_x; + ReturnCode_t return_code_x {eprosima::fastdds::dds::RETCODE_OK}; + return_code_x = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_x); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_x) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_x = 0x00000000; + bool common_x_ec {false}; + CommonStructMember common_x {TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_x, common_x_ec))}; + if (!common_x_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_AnInternalObject); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_x); + } + { + TypeIdentifierPair type_ids_positive; + ReturnCode_t return_code_positive {eprosima::fastdds::dds::RETCODE_OK}; + return_code_positive = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_positive); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_positive) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_positive = 0x00000001; + bool common_positive_ec {false}; + CommonStructMember common_positive {TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_positive, common_positive_ec))}; + if (!common_positive_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_AnInternalObject.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_AnInternalObject); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_AnInternalObject, member_positive); + } + CompleteStructType struct_type_AnInternalObject = TypeObjectUtils::build_complete_struct_type(struct_flags_AnInternalObject, header_AnInternalObject, member_seq_AnInternalObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_AnInternalObject, type_name_AnInternalObject.to_string(), type_ids_AnInternalObject)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "AnInternalObject already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_arrays_and_sequences_type_identifier( + TypeIdentifierPair& type_ids_arrays_and_sequences) +{ + + ReturnCode_t return_code_arrays_and_sequences {eprosima::fastdds::dds::RETCODE_OK}; + return_code_arrays_and_sequences = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "arrays_and_sequences", type_ids_arrays_and_sequences); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_arrays_and_sequences) + { + StructTypeFlag struct_flags_arrays_and_sequences = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_arrays_and_sequences = "arrays_and_sequences"; + eprosima::fastcdr::optional type_ann_builtin_arrays_and_sequences; + eprosima::fastcdr::optional ann_custom_arrays_and_sequences; + CompleteTypeDetail detail_arrays_and_sequences = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_arrays_and_sequences, ann_custom_arrays_and_sequences, type_name_arrays_and_sequences.to_string()); + CompleteStructHeader header_arrays_and_sequences; + header_arrays_and_sequences = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_arrays_and_sequences); + CompleteStructMemberSeq member_seq_arrays_and_sequences; + { + TypeIdentifierPair type_ids_unlimited_vector; + ReturnCode_t return_code_unlimited_vector {eprosima::fastdds::dds::RETCODE_OK}; + return_code_unlimited_vector = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_AnInternalObject_unbounded", type_ids_unlimited_vector); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_unlimited_vector) + { + return_code_unlimited_vector = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_unlimited_vector); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_unlimited_vector) + { + ::register_AnInternalObject_type_identifier(type_ids_unlimited_vector); + } + bool element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_unlimited_vector, element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_AnInternalObject_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_unlimited_vector.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_AnInternalObject_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_AnInternalObject_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_unbounded, element_flags_anonymous_sequence_AnInternalObject_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_unbounded", type_ids_unlimited_vector)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_unlimited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_unlimited_vector = 0x00000000; + bool common_unlimited_vector_ec {false}; + CommonStructMember common_unlimited_vector {TypeObjectUtils::build_common_struct_member(member_id_unlimited_vector, member_flags_unlimited_vector, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_unlimited_vector, common_unlimited_vector_ec))}; + if (!common_unlimited_vector_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure unlimited_vector member TypeIdentifier inconsistent."); + return; + } + MemberName name_unlimited_vector = "unlimited_vector"; + eprosima::fastcdr::optional member_ann_builtin_unlimited_vector; + ann_custom_arrays_and_sequences.reset(); + CompleteMemberDetail detail_unlimited_vector = TypeObjectUtils::build_complete_member_detail(name_unlimited_vector, member_ann_builtin_unlimited_vector, ann_custom_arrays_and_sequences); + CompleteStructMember member_unlimited_vector = TypeObjectUtils::build_complete_struct_member(common_unlimited_vector, detail_unlimited_vector); + TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_unlimited_vector); + } + { + TypeIdentifierPair type_ids_limited_vector; + ReturnCode_t return_code_limited_vector {eprosima::fastdds::dds::RETCODE_OK}; + return_code_limited_vector = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_AnInternalObject_10", type_ids_limited_vector); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_vector) + { + return_code_limited_vector = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_limited_vector); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_vector) + { + ::register_AnInternalObject_type_identifier(type_ids_limited_vector); + } + bool element_identifier_anonymous_sequence_AnInternalObject_10_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_AnInternalObject_10 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_vector, element_identifier_anonymous_sequence_AnInternalObject_10_ec))}; + if (!element_identifier_anonymous_sequence_AnInternalObject_10_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_COMPLETE; + if (TK_NONE == type_ids_limited_vector.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_AnInternalObject_10 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_AnInternalObject_10 = 0; + PlainCollectionHeader header_anonymous_sequence_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_AnInternalObject_10, element_flags_anonymous_sequence_AnInternalObject_10); + { + SBound bound = static_cast(10); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_AnInternalObject_10, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_AnInternalObject_10)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_AnInternalObject_10", type_ids_limited_vector)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_limited_vector = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_limited_vector = 0x00000001; + bool common_limited_vector_ec {false}; + CommonStructMember common_limited_vector {TypeObjectUtils::build_common_struct_member(member_id_limited_vector, member_flags_limited_vector, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_vector, common_limited_vector_ec))}; + if (!common_limited_vector_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure limited_vector member TypeIdentifier inconsistent."); + return; + } + MemberName name_limited_vector = "limited_vector"; + eprosima::fastcdr::optional member_ann_builtin_limited_vector; + ann_custom_arrays_and_sequences.reset(); + CompleteMemberDetail detail_limited_vector = TypeObjectUtils::build_complete_member_detail(name_limited_vector, member_ann_builtin_limited_vector, ann_custom_arrays_and_sequences); + CompleteStructMember member_limited_vector = TypeObjectUtils::build_complete_struct_member(common_limited_vector, detail_limited_vector); + TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_limited_vector); + } + { + TypeIdentifierPair type_ids_limited_array; + ReturnCode_t return_code_limited_array {eprosima::fastdds::dds::RETCODE_OK}; + return_code_limited_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_AnInternalObject_10", type_ids_limited_array); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_array) + { + return_code_limited_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "AnInternalObject", type_ids_limited_array); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_limited_array) + { + ::register_AnInternalObject_type_identifier(type_ids_limited_array); + } + bool element_identifier_anonymous_array_AnInternalObject_10_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_AnInternalObject_10 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_array, element_identifier_anonymous_array_AnInternalObject_10_ec))}; + if (!element_identifier_anonymous_array_AnInternalObject_10_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_AnInternalObject_10 = EK_COMPLETE; + if (TK_NONE == type_ids_limited_array.type_identifier2()._d()) + { + equiv_kind_anonymous_array_AnInternalObject_10 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_AnInternalObject_10 = 0; + PlainCollectionHeader header_anonymous_array_AnInternalObject_10 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_AnInternalObject_10, element_flags_anonymous_array_AnInternalObject_10); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(10)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_AnInternalObject_10, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_AnInternalObject_10)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_AnInternalObject_10", type_ids_limited_array)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_AnInternalObject_10 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_limited_array = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_limited_array = 0x00000002; + bool common_limited_array_ec {false}; + CommonStructMember common_limited_array {TypeObjectUtils::build_common_struct_member(member_id_limited_array, member_flags_limited_array, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_limited_array, common_limited_array_ec))}; + if (!common_limited_array_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure limited_array member TypeIdentifier inconsistent."); + return; + } + MemberName name_limited_array = "limited_array"; + eprosima::fastcdr::optional member_ann_builtin_limited_array; + ann_custom_arrays_and_sequences.reset(); + CompleteMemberDetail detail_limited_array = TypeObjectUtils::build_complete_member_detail(name_limited_array, member_ann_builtin_limited_array, ann_custom_arrays_and_sequences); + CompleteStructMember member_limited_array = TypeObjectUtils::build_complete_struct_member(common_limited_array, detail_limited_array); + TypeObjectUtils::add_complete_struct_member(member_seq_arrays_and_sequences, member_limited_array); + } + CompleteStructType struct_type_arrays_and_sequences = TypeObjectUtils::build_complete_struct_type(struct_flags_arrays_and_sequences, header_arrays_and_sequences, member_seq_arrays_and_sequences); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_arrays_and_sequences, type_name_arrays_and_sequences.to_string(), type_ids_arrays_and_sequences)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "arrays_and_sequences already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp new file mode 100644 index 00000000..43f145f3 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/arrays_and_sequencesTypeObjectSupport.hpp @@ -0,0 +1,68 @@ +// 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 arrays_and_sequencesTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_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 + +/** + * @brief Register AnInternalObject related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_AnInternalObject_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); +/** + * @brief Register arrays_and_sequences related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_arrays_and_sequences_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__ARRAYS_AND_SEQUENCES_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp new file mode 100644 index 00000000..1352a2e4 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_struct.hpp @@ -0,0 +1,386 @@ +// 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 basic_array_struct.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_HPP + +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(BASIC_ARRAY_STRUCT_SOURCE) +#define BASIC_ARRAY_STRUCT_DllAPI __declspec( dllexport ) +#else +#define BASIC_ARRAY_STRUCT_DllAPI __declspec( dllimport ) +#endif // BASIC_ARRAY_STRUCT_SOURCE +#else +#define BASIC_ARRAY_STRUCT_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define BASIC_ARRAY_STRUCT_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure TheOtherObjectInArray defined by the user in the IDL file. + * @ingroup basic_array_struct + */ +class TheOtherObjectInArray +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport TheOtherObjectInArray() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~TheOtherObjectInArray() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object TheOtherObjectInArray that will be copied. + */ + eProsima_user_DllExport TheOtherObjectInArray( + const TheOtherObjectInArray& x) + { + m_some_num = x.m_some_num; + + m_positive = x.m_positive; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object TheOtherObjectInArray that will be copied. + */ + eProsima_user_DllExport TheOtherObjectInArray( + TheOtherObjectInArray&& x) noexcept + { + m_some_num = x.m_some_num; + m_positive = x.m_positive; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object TheOtherObjectInArray that will be copied. + */ + eProsima_user_DllExport TheOtherObjectInArray& operator =( + const TheOtherObjectInArray& x) + { + + m_some_num = x.m_some_num; + + m_positive = x.m_positive; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object TheOtherObjectInArray that will be copied. + */ + eProsima_user_DllExport TheOtherObjectInArray& operator =( + TheOtherObjectInArray&& x) noexcept + { + + m_some_num = x.m_some_num; + m_positive = x.m_positive; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x TheOtherObjectInArray object to compare. + */ + eProsima_user_DllExport bool operator ==( + const TheOtherObjectInArray& x) const + { + return (m_some_num == x.m_some_num && + m_positive == x.m_positive); + } + + /*! + * @brief Comparison operator. + * @param x TheOtherObjectInArray object to compare. + */ + eProsima_user_DllExport bool operator !=( + const TheOtherObjectInArray& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member some_num + * @param _some_num New value for member some_num + */ + eProsima_user_DllExport void some_num( + int32_t _some_num) + { + m_some_num = _some_num; + } + + /*! + * @brief This function returns the value of member some_num + * @return Value of member some_num + */ + eProsima_user_DllExport int32_t some_num() const + { + return m_some_num; + } + + /*! + * @brief This function returns a reference to member some_num + * @return Reference to member some_num + */ + eProsima_user_DllExport int32_t& some_num() + { + return m_some_num; + } + + + /*! + * @brief This function sets a value in member positive + * @param _positive New value for member positive + */ + eProsima_user_DllExport void positive( + bool _positive) + { + m_positive = _positive; + } + + /*! + * @brief This function returns the value of member positive + * @return Value of member positive + */ + eProsima_user_DllExport bool positive() const + { + return m_positive; + } + + /*! + * @brief This function returns a reference to member positive + * @return Reference to member positive + */ + eProsima_user_DllExport bool& positive() + { + return m_positive; + } + + + +private: + + int32_t m_some_num{0}; + bool m_positive{false}; + +}; +/*! + * @brief This class represents the structure basic_array_struct defined by the user in the IDL file. + * @ingroup basic_array_struct + */ +class basic_array_struct +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport basic_array_struct() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~basic_array_struct() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object basic_array_struct that will be copied. + */ + eProsima_user_DllExport basic_array_struct( + const basic_array_struct& x) + { + m_index = x.m_index; + + m_sub_structs = x.m_sub_structs; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object basic_array_struct that will be copied. + */ + eProsima_user_DllExport basic_array_struct( + basic_array_struct&& x) noexcept + { + m_index = x.m_index; + m_sub_structs = std::move(x.m_sub_structs); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object basic_array_struct that will be copied. + */ + eProsima_user_DllExport basic_array_struct& operator =( + const basic_array_struct& x) + { + + m_index = x.m_index; + + m_sub_structs = x.m_sub_structs; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object basic_array_struct that will be copied. + */ + eProsima_user_DllExport basic_array_struct& operator =( + basic_array_struct&& x) noexcept + { + + m_index = x.m_index; + m_sub_structs = std::move(x.m_sub_structs); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x basic_array_struct object to compare. + */ + eProsima_user_DllExport bool operator ==( + const basic_array_struct& x) const + { + return (m_index == x.m_index && + m_sub_structs == x.m_sub_structs); + } + + /*! + * @brief Comparison operator. + * @param x basic_array_struct object to compare. + */ + eProsima_user_DllExport bool operator !=( + const basic_array_struct& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + eProsima_user_DllExport void index( + uint32_t _index) + { + m_index = _index; + } + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } + + + /*! + * @brief This function copies the value in member sub_structs + * @param _sub_structs New value to be copied in member sub_structs + */ + eProsima_user_DllExport void sub_structs( + const std::array& _sub_structs) + { + m_sub_structs = _sub_structs; + } + + /*! + * @brief This function moves the value in member sub_structs + * @param _sub_structs New value to be moved in member sub_structs + */ + eProsima_user_DllExport void sub_structs( + std::array&& _sub_structs) + { + m_sub_structs = std::move(_sub_structs); + } + + /*! + * @brief This function returns a constant reference to member sub_structs + * @return Constant reference to member sub_structs + */ + eProsima_user_DllExport const std::array& sub_structs() const + { + return m_sub_structs; + } + + /*! + * @brief This function returns a reference to member sub_structs + * @return Reference to member sub_structs + */ + eProsima_user_DllExport std::array& sub_structs() + { + return m_sub_structs; + } + + + +private: + + uint32_t m_index{0}; + std::array m_sub_structs; + +}; + +#endif // _FAST_DDS_GENERATED_BASIC_ARRAY_STRUCT_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp new file mode 100644 index 00000000..3bbf1a9a --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.hpp @@ -0,0 +1,53 @@ +// 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 basic_array_structCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP + +#include "basic_array_struct.hpp" + +constexpr uint32_t basic_array_struct_max_cdr_typesize {69UL}; +constexpr uint32_t basic_array_struct_max_key_cdr_typesize {0UL}; + +constexpr uint32_t TheOtherObjectInArray_max_cdr_typesize {9UL}; +constexpr uint32_t TheOtherObjectInArray_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const TheOtherObjectInArray& data); + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const basic_array_struct& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp new file mode 100644 index 00000000..306a17d3 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structCdrAux.ipp @@ -0,0 +1,220 @@ +// 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 basic_array_structCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP + +#include "basic_array_structCdrAux.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 TheOtherObjectInArray& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.some_num(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.positive(), 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 TheOtherObjectInArray& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.some_num() + << eprosima::fastcdr::MemberId(1) << data.positive() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + TheOtherObjectInArray& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.some_num(); + break; + + case 1: + dcdr >> data.positive(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const TheOtherObjectInArray& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.some_num(); + + scdr << data.positive(); + +} + + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const basic_array_struct& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.index(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.sub_structs(), 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 basic_array_struct& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.index() + << eprosima::fastcdr::MemberId(1) << data.sub_structs() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + basic_array_struct& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.index(); + break; + + case 1: + dcdr >> data.sub_structs(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const basic_array_struct& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.index(); + + scdr << data.sub_structs(); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCTCDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx new file mode 100644 index 00000000..1831718b --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.cxx @@ -0,0 +1,398 @@ +// 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 basic_array_structPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "basic_array_structPubSubTypes.hpp" + +#include +#include + +#include "basic_array_structCdrAux.hpp" +#include "basic_array_structTypeObjectSupport.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; + +TheOtherObjectInArrayPubSubType::TheOtherObjectInArrayPubSubType() +{ + set_name("TheOtherObjectInArray"); + uint32_t type_size = TheOtherObjectInArray_max_cdr_typesize; + 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; + uint32_t key_length = TheOtherObjectInArray_max_key_cdr_typesize > 16 ? TheOtherObjectInArray_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +TheOtherObjectInArrayPubSubType::~TheOtherObjectInArrayPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool TheOtherObjectInArrayPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const TheOtherObjectInArray* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool TheOtherObjectInArrayPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + TheOtherObjectInArray* 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; +} + +uint32_t TheOtherObjectInArrayPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* TheOtherObjectInArrayPubSubType::create_data() +{ + return reinterpret_cast(new TheOtherObjectInArray()); +} + +void TheOtherObjectInArrayPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool TheOtherObjectInArrayPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + TheOtherObjectInArray data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool TheOtherObjectInArrayPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const TheOtherObjectInArray* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + TheOtherObjectInArray_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || TheOtherObjectInArray_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void TheOtherObjectInArrayPubSubType::register_type_object_representation() +{ + register_TheOtherObjectInArray_type_identifier(type_identifiers_); +} + +basic_array_structPubSubType::basic_array_structPubSubType() +{ + set_name("basic_array_struct"); + uint32_t type_size = basic_array_struct_max_cdr_typesize; + 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; + uint32_t key_length = basic_array_struct_max_key_cdr_typesize > 16 ? basic_array_struct_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +basic_array_structPubSubType::~basic_array_structPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool basic_array_structPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const basic_array_struct* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool basic_array_structPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + basic_array_struct* 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; +} + +uint32_t basic_array_structPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* basic_array_structPubSubType::create_data() +{ + return reinterpret_cast(new basic_array_struct()); +} + +void basic_array_structPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool basic_array_structPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + basic_array_struct data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool basic_array_structPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const basic_array_struct* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + basic_array_struct_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || basic_array_struct_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void basic_array_structPubSubType::register_type_object_representation() +{ + register_basic_array_struct_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "basic_array_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp new file mode 100644 index 00000000..64c85f8e --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structPubSubTypes.hpp @@ -0,0 +1,204 @@ +// 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 basic_array_structPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "basic_array_struct.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated basic_array_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type TheOtherObjectInArray defined by the user in the IDL file. + * @ingroup basic_array_struct + */ +class TheOtherObjectInArrayPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef TheOtherObjectInArray type; + + eProsima_user_DllExport TheOtherObjectInArrayPubSubType(); + + eProsima_user_DllExport ~TheOtherObjectInArrayPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type basic_array_struct defined by the user in the IDL file. + * @ingroup basic_array_struct + */ +class basic_array_structPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef basic_array_struct type; + + eProsima_user_DllExport basic_array_structPubSubType(); + + eProsima_user_DllExport ~basic_array_structPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx new file mode 100644 index 00000000..242ea811 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.cxx @@ -0,0 +1,251 @@ +// 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 basic_array_structTypeObjectSupport.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. + */ + +#include "basic_array_structTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "basic_array_struct.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_TheOtherObjectInArray_type_identifier( + TypeIdentifierPair& type_ids_TheOtherObjectInArray) +{ + + ReturnCode_t return_code_TheOtherObjectInArray {eprosima::fastdds::dds::RETCODE_OK}; + return_code_TheOtherObjectInArray = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObjectInArray", type_ids_TheOtherObjectInArray); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObjectInArray) + { + StructTypeFlag struct_flags_TheOtherObjectInArray = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_TheOtherObjectInArray = "TheOtherObjectInArray"; + eprosima::fastcdr::optional type_ann_builtin_TheOtherObjectInArray; + eprosima::fastcdr::optional ann_custom_TheOtherObjectInArray; + CompleteTypeDetail detail_TheOtherObjectInArray = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObjectInArray, ann_custom_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string()); + CompleteStructHeader header_TheOtherObjectInArray; + header_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObjectInArray); + CompleteStructMemberSeq member_seq_TheOtherObjectInArray; + { + TypeIdentifierPair type_ids_some_num; + ReturnCode_t return_code_some_num {eprosima::fastdds::dds::RETCODE_OK}; + return_code_some_num = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_some_num); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_some_num) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_some_num = 0x00000000; + bool common_some_num_ec {false}; + CommonStructMember common_some_num {TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_some_num, common_some_num_ec))}; + if (!common_some_num_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure some_num member TypeIdentifier inconsistent."); + return; + } + MemberName name_some_num = "some_num"; + eprosima::fastcdr::optional member_ann_builtin_some_num; + ann_custom_TheOtherObjectInArray.reset(); + CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObjectInArray); + CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_some_num); + } + { + TypeIdentifierPair type_ids_positive; + ReturnCode_t return_code_positive {eprosima::fastdds::dds::RETCODE_OK}; + return_code_positive = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_bool", type_ids_positive); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_positive) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "positive Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_positive = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_positive = 0x00000001; + bool common_positive_ec {false}; + CommonStructMember common_positive {TypeObjectUtils::build_common_struct_member(member_id_positive, member_flags_positive, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_positive, common_positive_ec))}; + if (!common_positive_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure positive member TypeIdentifier inconsistent."); + return; + } + MemberName name_positive = "positive"; + eprosima::fastcdr::optional member_ann_builtin_positive; + ann_custom_TheOtherObjectInArray.reset(); + CompleteMemberDetail detail_positive = TypeObjectUtils::build_complete_member_detail(name_positive, member_ann_builtin_positive, ann_custom_TheOtherObjectInArray); + CompleteStructMember member_positive = TypeObjectUtils::build_complete_struct_member(common_positive, detail_positive); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObjectInArray, member_positive); + } + CompleteStructType struct_type_TheOtherObjectInArray = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObjectInArray, header_TheOtherObjectInArray, member_seq_TheOtherObjectInArray); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObjectInArray, type_name_TheOtherObjectInArray.to_string(), type_ids_TheOtherObjectInArray)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObjectInArray already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_basic_array_struct_type_identifier( + TypeIdentifierPair& type_ids_basic_array_struct) +{ + + ReturnCode_t return_code_basic_array_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_basic_array_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "basic_array_struct", type_ids_basic_array_struct); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_array_struct) + { + StructTypeFlag struct_flags_basic_array_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_basic_array_struct = "basic_array_struct"; + eprosima::fastcdr::optional type_ann_builtin_basic_array_struct; + eprosima::fastcdr::optional ann_custom_basic_array_struct; + CompleteTypeDetail detail_basic_array_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_basic_array_struct, ann_custom_basic_array_struct, type_name_basic_array_struct.to_string()); + CompleteStructHeader header_basic_array_struct; + header_basic_array_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_array_struct); + CompleteStructMemberSeq member_seq_basic_array_struct; + { + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_index); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_index = 0x00000000; + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_basic_array_struct.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_basic_array_struct); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_basic_array_struct, member_index); + } + { + TypeIdentifierPair type_ids_sub_structs; + ReturnCode_t return_code_sub_structs {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sub_structs = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_TheOtherObjectInArray_5", type_ids_sub_structs); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_structs) + { + return_code_sub_structs = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObjectInArray", type_ids_sub_structs); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_structs) + { + ::register_TheOtherObjectInArray_type_identifier(type_ids_sub_structs); + } + bool element_identifier_anonymous_array_TheOtherObjectInArray_5_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_TheOtherObjectInArray_5 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_structs, element_identifier_anonymous_array_TheOtherObjectInArray_5_ec))}; + if (!element_identifier_anonymous_array_TheOtherObjectInArray_5_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_COMPLETE; + if (TK_NONE == type_ids_sub_structs.type_identifier2()._d()) + { + equiv_kind_anonymous_array_TheOtherObjectInArray_5 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_TheOtherObjectInArray_5 = 0; + PlainCollectionHeader header_anonymous_array_TheOtherObjectInArray_5 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_TheOtherObjectInArray_5, element_flags_anonymous_array_TheOtherObjectInArray_5); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(5)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_TheOtherObjectInArray_5, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_TheOtherObjectInArray_5)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_TheOtherObjectInArray_5", type_ids_sub_structs)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_TheOtherObjectInArray_5 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_sub_structs = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_sub_structs = 0x00000001; + bool common_sub_structs_ec {false}; + CommonStructMember common_sub_structs {TypeObjectUtils::build_common_struct_member(member_id_sub_structs, member_flags_sub_structs, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_structs, common_sub_structs_ec))}; + if (!common_sub_structs_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub_structs member TypeIdentifier inconsistent."); + return; + } + MemberName name_sub_structs = "sub_structs"; + eprosima::fastcdr::optional member_ann_builtin_sub_structs; + ann_custom_basic_array_struct.reset(); + CompleteMemberDetail detail_sub_structs = TypeObjectUtils::build_complete_member_detail(name_sub_structs, member_ann_builtin_sub_structs, ann_custom_basic_array_struct); + CompleteStructMember member_sub_structs = TypeObjectUtils::build_complete_struct_member(common_sub_structs, detail_sub_structs); + TypeObjectUtils::add_complete_struct_member(member_seq_basic_array_struct, member_sub_structs); + } + CompleteStructType struct_type_basic_array_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_array_struct, header_basic_array_struct, member_seq_basic_array_struct); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_array_struct, type_name_basic_array_struct.to_string(), type_ids_basic_array_struct)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "basic_array_struct already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp new file mode 100644 index 00000000..afa3f5f9 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_array_structTypeObjectSupport.hpp @@ -0,0 +1,68 @@ +// 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 basic_array_structTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_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 + +/** + * @brief Register TheOtherObjectInArray related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_TheOtherObjectInArray_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); +/** + * @brief Register basic_array_struct related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_basic_array_struct_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__BASIC_ARRAY_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp new file mode 100644 index 00000000..9ba4805a --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_struct.hpp @@ -0,0 +1,311 @@ +// 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 basic_struct.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCT_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(BASIC_STRUCT_SOURCE) +#define BASIC_STRUCT_DllAPI __declspec( dllexport ) +#else +#define BASIC_STRUCT_DllAPI __declspec( dllimport ) +#endif // BASIC_STRUCT_SOURCE +#else +#define BASIC_STRUCT_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define BASIC_STRUCT_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure TheOtherObject defined by the user in the IDL file. + * @ingroup basic_struct + */ +class TheOtherObject +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport TheOtherObject() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~TheOtherObject() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object TheOtherObject that will be copied. + */ + eProsima_user_DllExport TheOtherObject( + const TheOtherObject& x) + { + m_some_num = x.m_some_num; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object TheOtherObject that will be copied. + */ + eProsima_user_DllExport TheOtherObject( + TheOtherObject&& x) noexcept + { + m_some_num = x.m_some_num; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object TheOtherObject that will be copied. + */ + eProsima_user_DllExport TheOtherObject& operator =( + const TheOtherObject& x) + { + + m_some_num = x.m_some_num; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object TheOtherObject that will be copied. + */ + eProsima_user_DllExport TheOtherObject& operator =( + TheOtherObject&& x) noexcept + { + + m_some_num = x.m_some_num; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x TheOtherObject object to compare. + */ + eProsima_user_DllExport bool operator ==( + const TheOtherObject& x) const + { + return (m_some_num == x.m_some_num); + } + + /*! + * @brief Comparison operator. + * @param x TheOtherObject object to compare. + */ + eProsima_user_DllExport bool operator !=( + const TheOtherObject& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member some_num + * @param _some_num New value for member some_num + */ + eProsima_user_DllExport void some_num( + int32_t _some_num) + { + m_some_num = _some_num; + } + + /*! + * @brief This function returns the value of member some_num + * @return Value of member some_num + */ + eProsima_user_DllExport int32_t some_num() const + { + return m_some_num; + } + + /*! + * @brief This function returns a reference to member some_num + * @return Reference to member some_num + */ + eProsima_user_DllExport int32_t& some_num() + { + return m_some_num; + } + + + +private: + + int32_t m_some_num{0}; + +}; +/*! + * @brief This class represents the structure basic_struct defined by the user in the IDL file. + * @ingroup basic_struct + */ +class basic_struct +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport basic_struct() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~basic_struct() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object basic_struct that will be copied. + */ + eProsima_user_DllExport basic_struct( + const basic_struct& x) + { + m_sub_struct = x.m_sub_struct; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object basic_struct that will be copied. + */ + eProsima_user_DllExport basic_struct( + basic_struct&& x) noexcept + { + m_sub_struct = std::move(x.m_sub_struct); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object basic_struct that will be copied. + */ + eProsima_user_DllExport basic_struct& operator =( + const basic_struct& x) + { + + m_sub_struct = x.m_sub_struct; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object basic_struct that will be copied. + */ + eProsima_user_DllExport basic_struct& operator =( + basic_struct&& x) noexcept + { + + m_sub_struct = std::move(x.m_sub_struct); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x basic_struct object to compare. + */ + eProsima_user_DllExport bool operator ==( + const basic_struct& x) const + { + return (m_sub_struct == x.m_sub_struct); + } + + /*! + * @brief Comparison operator. + * @param x basic_struct object to compare. + */ + eProsima_user_DllExport bool operator !=( + const basic_struct& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member sub_struct + * @param _sub_struct New value to be copied in member sub_struct + */ + eProsima_user_DllExport void sub_struct( + const TheOtherObject& _sub_struct) + { + m_sub_struct = _sub_struct; + } + + /*! + * @brief This function moves the value in member sub_struct + * @param _sub_struct New value to be moved in member sub_struct + */ + eProsima_user_DllExport void sub_struct( + TheOtherObject&& _sub_struct) + { + m_sub_struct = std::move(_sub_struct); + } + + /*! + * @brief This function returns a constant reference to member sub_struct + * @return Constant reference to member sub_struct + */ + eProsima_user_DllExport const TheOtherObject& sub_struct() const + { + return m_sub_struct; + } + + /*! + * @brief This function returns a reference to member sub_struct + * @return Reference to member sub_struct + */ + eProsima_user_DllExport TheOtherObject& sub_struct() + { + return m_sub_struct; + } + + + +private: + + TheOtherObject m_sub_struct; + +}; + +#endif // _FAST_DDS_GENERATED_BASIC_STRUCT_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp new file mode 100644 index 00000000..ac32e369 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.hpp @@ -0,0 +1,53 @@ +// 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 basic_structCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP + +#include "basic_struct.hpp" + +constexpr uint32_t basic_struct_max_cdr_typesize {12UL}; +constexpr uint32_t basic_struct_max_key_cdr_typesize {0UL}; + +constexpr uint32_t TheOtherObject_max_cdr_typesize {8UL}; +constexpr uint32_t TheOtherObject_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const TheOtherObject& data); + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const basic_struct& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp new file mode 100644 index 00000000..1d587488 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structCdrAux.ipp @@ -0,0 +1,204 @@ +// 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 basic_structCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP +#define FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP + +#include "basic_structCdrAux.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 TheOtherObject& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.some_num(), 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 TheOtherObject& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.some_num() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + TheOtherObject& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.some_num(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const TheOtherObject& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.some_num(); + +} + + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const basic_struct& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.sub_struct(), 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 basic_struct& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.sub_struct() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + basic_struct& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.sub_struct(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const basic_struct& data) +{ + extern void serialize_key( + Cdr& scdr, + const TheOtherObject& data); + + + static_cast(scdr); + static_cast(data); + serialize_key(scdr, data.sub_struct()); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__BASIC_STRUCTCDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx new file mode 100644 index 00000000..be5833ac --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.cxx @@ -0,0 +1,398 @@ +// 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 basic_structPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "basic_structPubSubTypes.hpp" + +#include +#include + +#include "basic_structCdrAux.hpp" +#include "basic_structTypeObjectSupport.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; + +TheOtherObjectPubSubType::TheOtherObjectPubSubType() +{ + set_name("TheOtherObject"); + uint32_t type_size = TheOtherObject_max_cdr_typesize; + 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; + uint32_t key_length = TheOtherObject_max_key_cdr_typesize > 16 ? TheOtherObject_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +TheOtherObjectPubSubType::~TheOtherObjectPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool TheOtherObjectPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const TheOtherObject* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool TheOtherObjectPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + TheOtherObject* 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; +} + +uint32_t TheOtherObjectPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* TheOtherObjectPubSubType::create_data() +{ + return reinterpret_cast(new TheOtherObject()); +} + +void TheOtherObjectPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool TheOtherObjectPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + TheOtherObject data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool TheOtherObjectPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const TheOtherObject* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + TheOtherObject_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || TheOtherObject_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void TheOtherObjectPubSubType::register_type_object_representation() +{ + register_TheOtherObject_type_identifier(type_identifiers_); +} + +basic_structPubSubType::basic_structPubSubType() +{ + set_name("basic_struct"); + uint32_t type_size = basic_struct_max_cdr_typesize; + 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; + uint32_t key_length = basic_struct_max_key_cdr_typesize > 16 ? basic_struct_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +basic_structPubSubType::~basic_structPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool basic_structPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const basic_struct* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool basic_structPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + basic_struct* 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; +} + +uint32_t basic_structPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* basic_structPubSubType::create_data() +{ + return reinterpret_cast(new basic_struct()); +} + +void basic_structPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool basic_structPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + basic_struct data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool basic_structPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const basic_struct* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + basic_struct_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || basic_struct_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void basic_structPubSubType::register_type_object_representation() +{ + register_basic_struct_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "basic_structCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp new file mode 100644 index 00000000..a1e0a185 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structPubSubTypes.hpp @@ -0,0 +1,204 @@ +// 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 basic_structPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "basic_struct.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated basic_struct is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type TheOtherObject defined by the user in the IDL file. + * @ingroup basic_struct + */ +class TheOtherObjectPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef TheOtherObject type; + + eProsima_user_DllExport TheOtherObjectPubSubType(); + + eProsima_user_DllExport ~TheOtherObjectPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type basic_struct defined by the user in the IDL file. + * @ingroup basic_struct + */ +class basic_structPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef basic_struct type; + + eProsima_user_DllExport basic_structPubSubType(); + + eProsima_user_DllExport ~basic_structPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__BASIC_STRUCT_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx new file mode 100644 index 00000000..b57ea0db --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.cxx @@ -0,0 +1,157 @@ +// 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 basic_structTypeObjectSupport.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. + */ + +#include "basic_structTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "basic_struct.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_TheOtherObject_type_identifier( + TypeIdentifierPair& type_ids_TheOtherObject) +{ + + ReturnCode_t return_code_TheOtherObject {eprosima::fastdds::dds::RETCODE_OK}; + return_code_TheOtherObject = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObject", type_ids_TheOtherObject); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_TheOtherObject) + { + StructTypeFlag struct_flags_TheOtherObject = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_TheOtherObject = "TheOtherObject"; + eprosima::fastcdr::optional type_ann_builtin_TheOtherObject; + eprosima::fastcdr::optional ann_custom_TheOtherObject; + CompleteTypeDetail detail_TheOtherObject = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_TheOtherObject, ann_custom_TheOtherObject, type_name_TheOtherObject.to_string()); + CompleteStructHeader header_TheOtherObject; + header_TheOtherObject = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_TheOtherObject); + CompleteStructMemberSeq member_seq_TheOtherObject; + { + TypeIdentifierPair type_ids_some_num; + ReturnCode_t return_code_some_num {eprosima::fastdds::dds::RETCODE_OK}; + return_code_some_num = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_some_num); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_some_num) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "some_num Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_some_num = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_some_num = 0x00000000; + bool common_some_num_ec {false}; + CommonStructMember common_some_num {TypeObjectUtils::build_common_struct_member(member_id_some_num, member_flags_some_num, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_some_num, common_some_num_ec))}; + if (!common_some_num_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure some_num member TypeIdentifier inconsistent."); + return; + } + MemberName name_some_num = "some_num"; + eprosima::fastcdr::optional member_ann_builtin_some_num; + ann_custom_TheOtherObject.reset(); + CompleteMemberDetail detail_some_num = TypeObjectUtils::build_complete_member_detail(name_some_num, member_ann_builtin_some_num, ann_custom_TheOtherObject); + CompleteStructMember member_some_num = TypeObjectUtils::build_complete_struct_member(common_some_num, detail_some_num); + TypeObjectUtils::add_complete_struct_member(member_seq_TheOtherObject, member_some_num); + } + CompleteStructType struct_type_TheOtherObject = TypeObjectUtils::build_complete_struct_type(struct_flags_TheOtherObject, header_TheOtherObject, member_seq_TheOtherObject); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_TheOtherObject, type_name_TheOtherObject.to_string(), type_ids_TheOtherObject)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "TheOtherObject already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_basic_struct_type_identifier( + TypeIdentifierPair& type_ids_basic_struct) +{ + + ReturnCode_t return_code_basic_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_basic_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "basic_struct", type_ids_basic_struct); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_basic_struct) + { + StructTypeFlag struct_flags_basic_struct = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_basic_struct = "basic_struct"; + eprosima::fastcdr::optional type_ann_builtin_basic_struct; + eprosima::fastcdr::optional ann_custom_basic_struct; + CompleteTypeDetail detail_basic_struct = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_basic_struct, ann_custom_basic_struct, type_name_basic_struct.to_string()); + CompleteStructHeader header_basic_struct; + header_basic_struct = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_basic_struct); + CompleteStructMemberSeq member_seq_basic_struct; + { + TypeIdentifierPair type_ids_sub_struct; + ReturnCode_t return_code_sub_struct {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sub_struct = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "TheOtherObject", type_ids_sub_struct); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub_struct) + { + ::register_TheOtherObject_type_identifier(type_ids_sub_struct); + } + StructMemberFlag member_flags_sub_struct = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_sub_struct = 0x00000000; + bool common_sub_struct_ec {false}; + CommonStructMember common_sub_struct {TypeObjectUtils::build_common_struct_member(member_id_sub_struct, member_flags_sub_struct, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub_struct, common_sub_struct_ec))}; + if (!common_sub_struct_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub_struct member TypeIdentifier inconsistent."); + return; + } + MemberName name_sub_struct = "sub_struct"; + eprosima::fastcdr::optional member_ann_builtin_sub_struct; + ann_custom_basic_struct.reset(); + CompleteMemberDetail detail_sub_struct = TypeObjectUtils::build_complete_member_detail(name_sub_struct, member_ann_builtin_sub_struct, ann_custom_basic_struct); + CompleteStructMember member_sub_struct = TypeObjectUtils::build_complete_struct_member(common_sub_struct, detail_sub_struct); + TypeObjectUtils::add_complete_struct_member(member_seq_basic_struct, member_sub_struct); + } + CompleteStructType struct_type_basic_struct = TypeObjectUtils::build_complete_struct_type(struct_flags_basic_struct, header_basic_struct, member_seq_basic_struct); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_basic_struct, type_name_basic_struct.to_string(), type_ids_basic_struct)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "basic_struct already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp new file mode 100644 index 00000000..d2cc9a74 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/basic_structTypeObjectSupport.hpp @@ -0,0 +1,68 @@ +// 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 basic_structTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__BASIC_STRUCT_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 + +/** + * @brief Register TheOtherObject related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_TheOtherObject_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); +/** + * @brief Register basic_struct related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_basic_struct_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__BASIC_STRUCT_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp new file mode 100644 index 00000000..98e9d533 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequence.hpp @@ -0,0 +1,190 @@ +// 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 char_sequence.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCE_HPP + +#include +#include +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(CHAR_SEQUENCE_SOURCE) +#define CHAR_SEQUENCE_DllAPI __declspec( dllexport ) +#else +#define CHAR_SEQUENCE_DllAPI __declspec( dllimport ) +#endif // CHAR_SEQUENCE_SOURCE +#else +#define CHAR_SEQUENCE_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define CHAR_SEQUENCE_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure char_sequence defined by the user in the IDL file. + * @ingroup char_sequence + */ +class char_sequence +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport char_sequence() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~char_sequence() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object char_sequence that will be copied. + */ + eProsima_user_DllExport char_sequence( + const char_sequence& x) + { + m_chars = x.m_chars; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object char_sequence that will be copied. + */ + eProsima_user_DllExport char_sequence( + char_sequence&& x) noexcept + { + m_chars = std::move(x.m_chars); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object char_sequence that will be copied. + */ + eProsima_user_DllExport char_sequence& operator =( + const char_sequence& x) + { + + m_chars = x.m_chars; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object char_sequence that will be copied. + */ + eProsima_user_DllExport char_sequence& operator =( + char_sequence&& x) noexcept + { + + m_chars = std::move(x.m_chars); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x char_sequence object to compare. + */ + eProsima_user_DllExport bool operator ==( + const char_sequence& x) const + { + return (m_chars == x.m_chars); + } + + /*! + * @brief Comparison operator. + * @param x char_sequence object to compare. + */ + eProsima_user_DllExport bool operator !=( + const char_sequence& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member chars + * @param _chars New value to be copied in member chars + */ + eProsima_user_DllExport void chars( + const std::vector& _chars) + { + m_chars = _chars; + } + + /*! + * @brief This function moves the value in member chars + * @param _chars New value to be moved in member chars + */ + eProsima_user_DllExport void chars( + std::vector&& _chars) + { + m_chars = std::move(_chars); + } + + /*! + * @brief This function returns a constant reference to member chars + * @return Constant reference to member chars + */ + eProsima_user_DllExport const std::vector& chars() const + { + return m_chars; + } + + /*! + * @brief This function returns a reference to member chars + * @return Reference to member chars + */ + eProsima_user_DllExport std::vector& chars() + { + return m_chars; + } + + + +private: + + std::vector m_chars; + +}; + +#endif // _FAST_DDS_GENERATED_CHAR_SEQUENCE_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp new file mode 100644 index 00000000..a1d9b9ad --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.hpp @@ -0,0 +1,46 @@ +// 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 char_sequenceCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP + +#include "char_sequence.hpp" + +constexpr uint32_t char_sequence_max_cdr_typesize {8UL}; +constexpr uint32_t char_sequence_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const char_sequence& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp new file mode 100644 index 00000000..a0ed4a86 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceCdrAux.ipp @@ -0,0 +1,121 @@ +// 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 char_sequenceCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP + +#include "char_sequenceCdrAux.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 char_sequence& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.chars(), 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 char_sequence& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.chars() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + char_sequence& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.chars(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const char_sequence& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.chars(); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCECDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx new file mode 100644 index 00000000..2fef40d1 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.cxx @@ -0,0 +1,217 @@ +// 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 char_sequencePubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "char_sequencePubSubTypes.hpp" + +#include +#include + +#include "char_sequenceCdrAux.hpp" +#include "char_sequenceTypeObjectSupport.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; + +char_sequencePubSubType::char_sequencePubSubType() +{ + set_name("char_sequence"); + uint32_t type_size = char_sequence_max_cdr_typesize; + 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; + uint32_t key_length = char_sequence_max_key_cdr_typesize > 16 ? char_sequence_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +char_sequencePubSubType::~char_sequencePubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool char_sequencePubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const char_sequence* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool char_sequencePubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + char_sequence* 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; +} + +uint32_t char_sequencePubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* char_sequencePubSubType::create_data() +{ + return reinterpret_cast(new char_sequence()); +} + +void char_sequencePubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool char_sequencePubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + char_sequence data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool char_sequencePubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const char_sequence* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + char_sequence_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || char_sequence_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void char_sequencePubSubType::register_type_object_representation() +{ + register_char_sequence_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "char_sequenceCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp new file mode 100644 index 00000000..bf0c5369 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequencePubSubTypes.hpp @@ -0,0 +1,123 @@ +// 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 char_sequencePubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "char_sequence.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated char_sequence is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type char_sequence defined by the user in the IDL file. + * @ingroup char_sequence + */ +class char_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef char_sequence type; + + eProsima_user_DllExport char_sequencePubSubType(); + + eProsima_user_DllExport ~char_sequencePubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCE_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx new file mode 100644 index 00000000..24ddf288 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.cxx @@ -0,0 +1,132 @@ +// 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 char_sequenceTypeObjectSupport.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. + */ + +#include "char_sequenceTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "char_sequence.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_char_sequence_type_identifier( + TypeIdentifierPair& type_ids_char_sequence) +{ + + ReturnCode_t return_code_char_sequence {eprosima::fastdds::dds::RETCODE_OK}; + return_code_char_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "char_sequence", type_ids_char_sequence); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_char_sequence) + { + StructTypeFlag struct_flags_char_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_char_sequence = "char_sequence"; + eprosima::fastcdr::optional type_ann_builtin_char_sequence; + eprosima::fastcdr::optional ann_custom_char_sequence; + CompleteTypeDetail detail_char_sequence = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_char_sequence, ann_custom_char_sequence, type_name_char_sequence.to_string()); + CompleteStructHeader header_char_sequence; + header_char_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_char_sequence); + CompleteStructMemberSeq member_seq_char_sequence; + { + TypeIdentifierPair type_ids_chars; + ReturnCode_t return_code_chars {eprosima::fastdds::dds::RETCODE_OK}; + return_code_chars = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_char_unbounded", type_ids_chars); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_chars) + { + return_code_chars = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_char", type_ids_chars); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_chars) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_sequence_char_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_char_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_chars, element_identifier_anonymous_sequence_char_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_char_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_char_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_chars.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_char_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_char_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_char_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_char_unbounded, element_flags_anonymous_sequence_char_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_char_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_char_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_char_unbounded", type_ids_chars)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_char_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_chars = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_chars = 0x00000000; + bool common_chars_ec {false}; + CommonStructMember common_chars {TypeObjectUtils::build_common_struct_member(member_id_chars, member_flags_chars, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_chars, common_chars_ec))}; + if (!common_chars_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure chars member TypeIdentifier inconsistent."); + return; + } + MemberName name_chars = "chars"; + eprosima::fastcdr::optional member_ann_builtin_chars; + ann_custom_char_sequence.reset(); + CompleteMemberDetail detail_chars = TypeObjectUtils::build_complete_member_detail(name_chars, member_ann_builtin_chars, ann_custom_char_sequence); + CompleteStructMember member_chars = TypeObjectUtils::build_complete_struct_member(common_chars, detail_chars); + TypeObjectUtils::add_complete_struct_member(member_seq_char_sequence, member_chars); + } + CompleteStructType struct_type_char_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_char_sequence, header_char_sequence, member_seq_char_sequence); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_char_sequence, type_name_char_sequence.to_string(), type_ids_char_sequence)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "char_sequence already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp new file mode 100644 index 00000000..45d4779e --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/char_sequenceTypeObjectSupport.hpp @@ -0,0 +1,56 @@ +// 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 char_sequenceTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__CHAR_SEQUENCE_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 + +/** + * @brief Register char_sequence related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_char_sequence_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__CHAR_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp new file mode 100644 index 00000000..1f7a722b --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arrays.hpp @@ -0,0 +1,760 @@ +// 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 complex_nested_arrays.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_HPP + +#include +#include +#include +#include +#include + +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(COMPLEX_NESTED_ARRAYS_SOURCE) +#define COMPLEX_NESTED_ARRAYS_DllAPI __declspec( dllexport ) +#else +#define COMPLEX_NESTED_ARRAYS_DllAPI __declspec( dllimport ) +#endif // COMPLEX_NESTED_ARRAYS_SOURCE +#else +#define COMPLEX_NESTED_ARRAYS_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define COMPLEX_NESTED_ARRAYS_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure ThirdLevelElement defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class ThirdLevelElement +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport ThirdLevelElement() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~ThirdLevelElement() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object ThirdLevelElement that will be copied. + */ + eProsima_user_DllExport ThirdLevelElement( + const ThirdLevelElement& x) + { + m_x = x.m_x; + + m_y = x.m_y; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object ThirdLevelElement that will be copied. + */ + eProsima_user_DllExport ThirdLevelElement( + ThirdLevelElement&& x) noexcept + { + m_x = x.m_x; + m_y = x.m_y; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object ThirdLevelElement that will be copied. + */ + eProsima_user_DllExport ThirdLevelElement& operator =( + const ThirdLevelElement& x) + { + + m_x = x.m_x; + + m_y = x.m_y; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object ThirdLevelElement that will be copied. + */ + eProsima_user_DllExport ThirdLevelElement& operator =( + ThirdLevelElement&& x) noexcept + { + + m_x = x.m_x; + m_y = x.m_y; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x ThirdLevelElement object to compare. + */ + eProsima_user_DllExport bool operator ==( + const ThirdLevelElement& x) const + { + return (m_x == x.m_x && + m_y == x.m_y); + } + + /*! + * @brief Comparison operator. + * @param x ThirdLevelElement object to compare. + */ + eProsima_user_DllExport bool operator !=( + const ThirdLevelElement& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member x + * @param _x New value for member x + */ + eProsima_user_DllExport void x( + double _x) + { + m_x = _x; + } + + /*! + * @brief This function returns the value of member x + * @return Value of member x + */ + eProsima_user_DllExport double x() const + { + return m_x; + } + + /*! + * @brief This function returns a reference to member x + * @return Reference to member x + */ + eProsima_user_DllExport double& x() + { + return m_x; + } + + + /*! + * @brief This function sets a value in member y + * @param _y New value for member y + */ + eProsima_user_DllExport void y( + double _y) + { + m_y = _y; + } + + /*! + * @brief This function returns the value of member y + * @return Value of member y + */ + eProsima_user_DllExport double y() const + { + return m_y; + } + + /*! + * @brief This function returns a reference to member y + * @return Reference to member y + */ + eProsima_user_DllExport double& y() + { + return m_y; + } + + + +private: + + double m_x{0.0}; + double m_y{0.0}; + +}; +/*! + * @brief This class represents the structure SecondLevelElement defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class SecondLevelElement +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport SecondLevelElement() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~SecondLevelElement() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object SecondLevelElement that will be copied. + */ + eProsima_user_DllExport SecondLevelElement( + const SecondLevelElement& x) + { + m_an_element_alone = x.m_an_element_alone; + + m_a_limited_other_value = x.m_a_limited_other_value; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object SecondLevelElement that will be copied. + */ + eProsima_user_DllExport SecondLevelElement( + SecondLevelElement&& x) noexcept + { + m_an_element_alone = std::move(x.m_an_element_alone); + m_a_limited_other_value = std::move(x.m_a_limited_other_value); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object SecondLevelElement that will be copied. + */ + eProsima_user_DllExport SecondLevelElement& operator =( + const SecondLevelElement& x) + { + + m_an_element_alone = x.m_an_element_alone; + + m_a_limited_other_value = x.m_a_limited_other_value; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object SecondLevelElement that will be copied. + */ + eProsima_user_DllExport SecondLevelElement& operator =( + SecondLevelElement&& x) noexcept + { + + m_an_element_alone = std::move(x.m_an_element_alone); + m_a_limited_other_value = std::move(x.m_a_limited_other_value); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x SecondLevelElement object to compare. + */ + eProsima_user_DllExport bool operator ==( + const SecondLevelElement& x) const + { + return (m_an_element_alone == x.m_an_element_alone && + m_a_limited_other_value == x.m_a_limited_other_value); + } + + /*! + * @brief Comparison operator. + * @param x SecondLevelElement object to compare. + */ + eProsima_user_DllExport bool operator !=( + const SecondLevelElement& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member an_element_alone + * @param _an_element_alone New value to be copied in member an_element_alone + */ + eProsima_user_DllExport void an_element_alone( + const ThirdLevelElement& _an_element_alone) + { + m_an_element_alone = _an_element_alone; + } + + /*! + * @brief This function moves the value in member an_element_alone + * @param _an_element_alone New value to be moved in member an_element_alone + */ + eProsima_user_DllExport void an_element_alone( + ThirdLevelElement&& _an_element_alone) + { + m_an_element_alone = std::move(_an_element_alone); + } + + /*! + * @brief This function returns a constant reference to member an_element_alone + * @return Constant reference to member an_element_alone + */ + eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const + { + return m_an_element_alone; + } + + /*! + * @brief This function returns a reference to member an_element_alone + * @return Reference to member an_element_alone + */ + eProsima_user_DllExport ThirdLevelElement& an_element_alone() + { + return m_an_element_alone; + } + + + /*! + * @brief This function copies the value in member a_limited_other_value + * @param _a_limited_other_value New value to be copied in member a_limited_other_value + */ + eProsima_user_DllExport void a_limited_other_value( + const std::vector& _a_limited_other_value) + { + m_a_limited_other_value = _a_limited_other_value; + } + + /*! + * @brief This function moves the value in member a_limited_other_value + * @param _a_limited_other_value New value to be moved in member a_limited_other_value + */ + eProsima_user_DllExport void a_limited_other_value( + std::vector&& _a_limited_other_value) + { + m_a_limited_other_value = std::move(_a_limited_other_value); + } + + /*! + * @brief This function returns a constant reference to member a_limited_other_value + * @return Constant reference to member a_limited_other_value + */ + eProsima_user_DllExport const std::vector& a_limited_other_value() const + { + return m_a_limited_other_value; + } + + /*! + * @brief This function returns a reference to member a_limited_other_value + * @return Reference to member a_limited_other_value + */ + eProsima_user_DllExport std::vector& a_limited_other_value() + { + return m_a_limited_other_value; + } + + + +private: + + ThirdLevelElement m_an_element_alone; + std::vector m_a_limited_other_value; + +}; +/*! + * @brief This class represents the structure FirstLevelElement defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class FirstLevelElement +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport FirstLevelElement() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~FirstLevelElement() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object FirstLevelElement that will be copied. + */ + eProsima_user_DllExport FirstLevelElement( + const FirstLevelElement& x) + { + m_useless_name = x.m_useless_name; + + m_sub = x.m_sub; + + m_an_element_alone = x.m_an_element_alone; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object FirstLevelElement that will be copied. + */ + eProsima_user_DllExport FirstLevelElement( + FirstLevelElement&& x) noexcept + { + m_useless_name = std::move(x.m_useless_name); + m_sub = std::move(x.m_sub); + m_an_element_alone = std::move(x.m_an_element_alone); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object FirstLevelElement that will be copied. + */ + eProsima_user_DllExport FirstLevelElement& operator =( + const FirstLevelElement& x) + { + + m_useless_name = x.m_useless_name; + + m_sub = x.m_sub; + + m_an_element_alone = x.m_an_element_alone; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object FirstLevelElement that will be copied. + */ + eProsima_user_DllExport FirstLevelElement& operator =( + FirstLevelElement&& x) noexcept + { + + m_useless_name = std::move(x.m_useless_name); + m_sub = std::move(x.m_sub); + m_an_element_alone = std::move(x.m_an_element_alone); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x FirstLevelElement object to compare. + */ + eProsima_user_DllExport bool operator ==( + const FirstLevelElement& x) const + { + return (m_useless_name == x.m_useless_name && + m_sub == x.m_sub && + m_an_element_alone == x.m_an_element_alone); + } + + /*! + * @brief Comparison operator. + * @param x FirstLevelElement object to compare. + */ + eProsima_user_DllExport bool operator !=( + const FirstLevelElement& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member useless_name + * @param _useless_name New value to be copied in member useless_name + */ + eProsima_user_DllExport void useless_name( + const std::string& _useless_name) + { + m_useless_name = _useless_name; + } + + /*! + * @brief This function moves the value in member useless_name + * @param _useless_name New value to be moved in member useless_name + */ + eProsima_user_DllExport void useless_name( + std::string&& _useless_name) + { + m_useless_name = std::move(_useless_name); + } + + /*! + * @brief This function returns a constant reference to member useless_name + * @return Constant reference to member useless_name + */ + eProsima_user_DllExport const std::string& useless_name() const + { + return m_useless_name; + } + + /*! + * @brief This function returns a reference to member useless_name + * @return Reference to member useless_name + */ + eProsima_user_DllExport std::string& useless_name() + { + return m_useless_name; + } + + + /*! + * @brief This function copies the value in member sub + * @param _sub New value to be copied in member sub + */ + eProsima_user_DllExport void sub( + const std::vector& _sub) + { + m_sub = _sub; + } + + /*! + * @brief This function moves the value in member sub + * @param _sub New value to be moved in member sub + */ + eProsima_user_DllExport void sub( + std::vector&& _sub) + { + m_sub = std::move(_sub); + } + + /*! + * @brief This function returns a constant reference to member sub + * @return Constant reference to member sub + */ + eProsima_user_DllExport const std::vector& sub() const + { + return m_sub; + } + + /*! + * @brief This function returns a reference to member sub + * @return Reference to member sub + */ + eProsima_user_DllExport std::vector& sub() + { + return m_sub; + } + + + /*! + * @brief This function copies the value in member an_element_alone + * @param _an_element_alone New value to be copied in member an_element_alone + */ + eProsima_user_DllExport void an_element_alone( + const ThirdLevelElement& _an_element_alone) + { + m_an_element_alone = _an_element_alone; + } + + /*! + * @brief This function moves the value in member an_element_alone + * @param _an_element_alone New value to be moved in member an_element_alone + */ + eProsima_user_DllExport void an_element_alone( + ThirdLevelElement&& _an_element_alone) + { + m_an_element_alone = std::move(_an_element_alone); + } + + /*! + * @brief This function returns a constant reference to member an_element_alone + * @return Constant reference to member an_element_alone + */ + eProsima_user_DllExport const ThirdLevelElement& an_element_alone() const + { + return m_an_element_alone; + } + + /*! + * @brief This function returns a reference to member an_element_alone + * @return Reference to member an_element_alone + */ + eProsima_user_DllExport ThirdLevelElement& an_element_alone() + { + return m_an_element_alone; + } + + + +private: + + std::string m_useless_name; + std::vector m_sub; + ThirdLevelElement m_an_element_alone; + +}; +/*! + * @brief This class represents the structure complex_nested_arrays defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class complex_nested_arrays +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport complex_nested_arrays() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~complex_nested_arrays() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object complex_nested_arrays that will be copied. + */ + eProsima_user_DllExport complex_nested_arrays( + const complex_nested_arrays& x) + { + m_array_of_elements = x.m_array_of_elements; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object complex_nested_arrays that will be copied. + */ + eProsima_user_DllExport complex_nested_arrays( + complex_nested_arrays&& x) noexcept + { + m_array_of_elements = std::move(x.m_array_of_elements); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object complex_nested_arrays that will be copied. + */ + eProsima_user_DllExport complex_nested_arrays& operator =( + const complex_nested_arrays& x) + { + + m_array_of_elements = x.m_array_of_elements; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object complex_nested_arrays that will be copied. + */ + eProsima_user_DllExport complex_nested_arrays& operator =( + complex_nested_arrays&& x) noexcept + { + + m_array_of_elements = std::move(x.m_array_of_elements); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x complex_nested_arrays object to compare. + */ + eProsima_user_DllExport bool operator ==( + const complex_nested_arrays& x) const + { + return (m_array_of_elements == x.m_array_of_elements); + } + + /*! + * @brief Comparison operator. + * @param x complex_nested_arrays object to compare. + */ + eProsima_user_DllExport bool operator !=( + const complex_nested_arrays& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member array_of_elements + * @param _array_of_elements New value to be copied in member array_of_elements + */ + eProsima_user_DllExport void array_of_elements( + const std::array& _array_of_elements) + { + m_array_of_elements = _array_of_elements; + } + + /*! + * @brief This function moves the value in member array_of_elements + * @param _array_of_elements New value to be moved in member array_of_elements + */ + eProsima_user_DllExport void array_of_elements( + std::array&& _array_of_elements) + { + m_array_of_elements = std::move(_array_of_elements); + } + + /*! + * @brief This function returns a constant reference to member array_of_elements + * @return Constant reference to member array_of_elements + */ + eProsima_user_DllExport const std::array& array_of_elements() const + { + return m_array_of_elements; + } + + /*! + * @brief This function returns a reference to member array_of_elements + * @return Reference to member array_of_elements + */ + eProsima_user_DllExport std::array& array_of_elements() + { + return m_array_of_elements; + } + + + +private: + + std::array m_array_of_elements; + +}; + +#endif // _FAST_DDS_GENERATED_COMPLEX_NESTED_ARRAYS_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp new file mode 100644 index 00000000..d5085176 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.hpp @@ -0,0 +1,67 @@ +// 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 complex_nested_arraysCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP + +#include "complex_nested_arrays.hpp" + +constexpr uint32_t FirstLevelElement_max_cdr_typesize {296UL}; +constexpr uint32_t FirstLevelElement_max_key_cdr_typesize {0UL}; + +constexpr uint32_t ThirdLevelElement_max_cdr_typesize {24UL}; +constexpr uint32_t ThirdLevelElement_max_key_cdr_typesize {0UL}; + +constexpr uint32_t SecondLevelElement_max_cdr_typesize {56UL}; +constexpr uint32_t SecondLevelElement_max_key_cdr_typesize {0UL}; + +constexpr uint32_t complex_nested_arrays_max_cdr_typesize {896UL}; +constexpr uint32_t complex_nested_arrays_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const ThirdLevelElement& data); + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const SecondLevelElement& data); + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const FirstLevelElement& data); + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const complex_nested_arrays& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp new file mode 100644 index 00000000..143f7253 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysCdrAux.ipp @@ -0,0 +1,407 @@ +// 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 complex_nested_arraysCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP + +#include "complex_nested_arraysCdrAux.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 ThirdLevelElement& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.x(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.y(), 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 ThirdLevelElement& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.x() + << eprosima::fastcdr::MemberId(1) << data.y() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + ThirdLevelElement& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.x(); + break; + + case 1: + dcdr >> data.y(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const ThirdLevelElement& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.x(); + + scdr << data.y(); + +} + + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const SecondLevelElement& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.an_element_alone(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.a_limited_other_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 SecondLevelElement& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.an_element_alone() + << eprosima::fastcdr::MemberId(1) << data.a_limited_other_value() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + SecondLevelElement& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.an_element_alone(); + break; + + case 1: + dcdr >> data.a_limited_other_value(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const SecondLevelElement& data) +{ + extern void serialize_key( + Cdr& scdr, + const ThirdLevelElement& data); + + + + static_cast(scdr); + static_cast(data); + serialize_key(scdr, data.an_element_alone()); + + scdr << data.a_limited_other_value(); + +} + + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const FirstLevelElement& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.useless_name(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.sub(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), + data.an_element_alone(), 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 FirstLevelElement& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.useless_name() + << eprosima::fastcdr::MemberId(1) << data.sub() + << eprosima::fastcdr::MemberId(2) << data.an_element_alone() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + FirstLevelElement& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.useless_name(); + break; + + case 1: + dcdr >> data.sub(); + break; + + case 2: + dcdr >> data.an_element_alone(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const FirstLevelElement& data) +{ + extern void serialize_key( + Cdr& scdr, + const ThirdLevelElement& data); + + + static_cast(scdr); + static_cast(data); + scdr << data.useless_name(); + + scdr << data.sub(); + + serialize_key(scdr, data.an_element_alone()); + +} + + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const complex_nested_arrays& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.array_of_elements(), 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 complex_nested_arrays& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.array_of_elements() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + complex_nested_arrays& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.array_of_elements(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const complex_nested_arrays& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.array_of_elements(); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYSCDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx new file mode 100644 index 00000000..1797b2e6 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.cxx @@ -0,0 +1,760 @@ +// 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 complex_nested_arraysPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "complex_nested_arraysPubSubTypes.hpp" + +#include +#include + +#include "complex_nested_arraysCdrAux.hpp" +#include "complex_nested_arraysTypeObjectSupport.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; + +ThirdLevelElementPubSubType::ThirdLevelElementPubSubType() +{ + set_name("ThirdLevelElement"); + uint32_t type_size = ThirdLevelElement_max_cdr_typesize; + 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; + uint32_t key_length = ThirdLevelElement_max_key_cdr_typesize > 16 ? ThirdLevelElement_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +ThirdLevelElementPubSubType::~ThirdLevelElementPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool ThirdLevelElementPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const ThirdLevelElement* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool ThirdLevelElementPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + ThirdLevelElement* 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; +} + +uint32_t ThirdLevelElementPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* ThirdLevelElementPubSubType::create_data() +{ + return reinterpret_cast(new ThirdLevelElement()); +} + +void ThirdLevelElementPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool ThirdLevelElementPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + ThirdLevelElement data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool ThirdLevelElementPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const ThirdLevelElement* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + ThirdLevelElement_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || ThirdLevelElement_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void ThirdLevelElementPubSubType::register_type_object_representation() +{ + register_ThirdLevelElement_type_identifier(type_identifiers_); +} + +SecondLevelElementPubSubType::SecondLevelElementPubSubType() +{ + set_name("SecondLevelElement"); + uint32_t type_size = SecondLevelElement_max_cdr_typesize; + 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; + uint32_t key_length = SecondLevelElement_max_key_cdr_typesize > 16 ? SecondLevelElement_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +SecondLevelElementPubSubType::~SecondLevelElementPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool SecondLevelElementPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const SecondLevelElement* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool SecondLevelElementPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + SecondLevelElement* 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; +} + +uint32_t SecondLevelElementPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* SecondLevelElementPubSubType::create_data() +{ + return reinterpret_cast(new SecondLevelElement()); +} + +void SecondLevelElementPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool SecondLevelElementPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + SecondLevelElement data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool SecondLevelElementPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const SecondLevelElement* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + SecondLevelElement_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || SecondLevelElement_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void SecondLevelElementPubSubType::register_type_object_representation() +{ + register_SecondLevelElement_type_identifier(type_identifiers_); +} + +FirstLevelElementPubSubType::FirstLevelElementPubSubType() +{ + set_name("FirstLevelElement"); + uint32_t type_size = FirstLevelElement_max_cdr_typesize; + 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; + uint32_t key_length = FirstLevelElement_max_key_cdr_typesize > 16 ? FirstLevelElement_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +FirstLevelElementPubSubType::~FirstLevelElementPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool FirstLevelElementPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const FirstLevelElement* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool FirstLevelElementPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + FirstLevelElement* 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; +} + +uint32_t FirstLevelElementPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* FirstLevelElementPubSubType::create_data() +{ + return reinterpret_cast(new FirstLevelElement()); +} + +void FirstLevelElementPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool FirstLevelElementPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + FirstLevelElement data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool FirstLevelElementPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const FirstLevelElement* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + FirstLevelElement_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || FirstLevelElement_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void FirstLevelElementPubSubType::register_type_object_representation() +{ + register_FirstLevelElement_type_identifier(type_identifiers_); +} + +complex_nested_arraysPubSubType::complex_nested_arraysPubSubType() +{ + set_name("complex_nested_arrays"); + uint32_t type_size = complex_nested_arrays_max_cdr_typesize; + 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; + uint32_t key_length = complex_nested_arrays_max_key_cdr_typesize > 16 ? complex_nested_arrays_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +complex_nested_arraysPubSubType::~complex_nested_arraysPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool complex_nested_arraysPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const complex_nested_arrays* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool complex_nested_arraysPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + complex_nested_arrays* 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; +} + +uint32_t complex_nested_arraysPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* complex_nested_arraysPubSubType::create_data() +{ + return reinterpret_cast(new complex_nested_arrays()); +} + +void complex_nested_arraysPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool complex_nested_arraysPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + complex_nested_arrays data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool complex_nested_arraysPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const complex_nested_arrays* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + complex_nested_arrays_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || complex_nested_arrays_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void complex_nested_arraysPubSubType::register_type_object_representation() +{ + register_complex_nested_arrays_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "complex_nested_arraysCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp new file mode 100644 index 00000000..5d9d8177 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysPubSubTypes.hpp @@ -0,0 +1,366 @@ +// 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 complex_nested_arraysPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "complex_nested_arrays.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated complex_nested_arrays is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type ThirdLevelElement defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class ThirdLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef ThirdLevelElement type; + + eProsima_user_DllExport ThirdLevelElementPubSubType(); + + eProsima_user_DllExport ~ThirdLevelElementPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type SecondLevelElement defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class SecondLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef SecondLevelElement type; + + eProsima_user_DllExport SecondLevelElementPubSubType(); + + eProsima_user_DllExport ~SecondLevelElementPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type FirstLevelElement defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class FirstLevelElementPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef FirstLevelElement type; + + eProsima_user_DllExport FirstLevelElementPubSubType(); + + eProsima_user_DllExport ~FirstLevelElementPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type complex_nested_arrays defined by the user in the IDL file. + * @ingroup complex_nested_arrays + */ +class complex_nested_arraysPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef complex_nested_arrays type; + + eProsima_user_DllExport complex_nested_arraysPubSubType(); + + eProsima_user_DllExport ~complex_nested_arraysPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx new file mode 100644 index 00000000..2e9d0cf4 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.cxx @@ -0,0 +1,493 @@ +// 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 complex_nested_arraysTypeObjectSupport.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. + */ + +#include "complex_nested_arraysTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "complex_nested_arrays.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_ThirdLevelElement_type_identifier( + TypeIdentifierPair& type_ids_ThirdLevelElement) +{ + + ReturnCode_t return_code_ThirdLevelElement {eprosima::fastdds::dds::RETCODE_OK}; + return_code_ThirdLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_ThirdLevelElement) + { + StructTypeFlag struct_flags_ThirdLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_ThirdLevelElement = "ThirdLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_ThirdLevelElement; + eprosima::fastcdr::optional ann_custom_ThirdLevelElement; + CompleteTypeDetail detail_ThirdLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ThirdLevelElement, ann_custom_ThirdLevelElement, type_name_ThirdLevelElement.to_string()); + CompleteStructHeader header_ThirdLevelElement; + header_ThirdLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_ThirdLevelElement); + CompleteStructMemberSeq member_seq_ThirdLevelElement; + { + TypeIdentifierPair type_ids_x; + ReturnCode_t return_code_x {eprosima::fastdds::dds::RETCODE_OK}; + return_code_x = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_x); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_x) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "x Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_x = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_x = 0x00000000; + bool common_x_ec {false}; + CommonStructMember common_x {TypeObjectUtils::build_common_struct_member(member_id_x, member_flags_x, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_x, common_x_ec))}; + if (!common_x_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure x member TypeIdentifier inconsistent."); + return; + } + MemberName name_x = "x"; + eprosima::fastcdr::optional member_ann_builtin_x; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_x = TypeObjectUtils::build_complete_member_detail(name_x, member_ann_builtin_x, ann_custom_ThirdLevelElement); + CompleteStructMember member_x = TypeObjectUtils::build_complete_struct_member(common_x, detail_x); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_x); + } + { + TypeIdentifierPair type_ids_y; + ReturnCode_t return_code_y {eprosima::fastdds::dds::RETCODE_OK}; + return_code_y = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_double", type_ids_y); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_y) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "y Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_y = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_y = 0x00000001; + bool common_y_ec {false}; + CommonStructMember common_y {TypeObjectUtils::build_common_struct_member(member_id_y, member_flags_y, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_y, common_y_ec))}; + if (!common_y_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure y member TypeIdentifier inconsistent."); + return; + } + MemberName name_y = "y"; + eprosima::fastcdr::optional member_ann_builtin_y; + ann_custom_ThirdLevelElement.reset(); + CompleteMemberDetail detail_y = TypeObjectUtils::build_complete_member_detail(name_y, member_ann_builtin_y, ann_custom_ThirdLevelElement); + CompleteStructMember member_y = TypeObjectUtils::build_complete_struct_member(common_y, detail_y); + TypeObjectUtils::add_complete_struct_member(member_seq_ThirdLevelElement, member_y); + } + CompleteStructType struct_type_ThirdLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_ThirdLevelElement, header_ThirdLevelElement, member_seq_ThirdLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_ThirdLevelElement, type_name_ThirdLevelElement.to_string(), type_ids_ThirdLevelElement)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "ThirdLevelElement already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_SecondLevelElement_type_identifier( + TypeIdentifierPair& type_ids_SecondLevelElement) +{ + + ReturnCode_t return_code_SecondLevelElement {eprosima::fastdds::dds::RETCODE_OK}; + return_code_SecondLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_SecondLevelElement); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_SecondLevelElement) + { + StructTypeFlag struct_flags_SecondLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_SecondLevelElement = "SecondLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_SecondLevelElement; + eprosima::fastcdr::optional ann_custom_SecondLevelElement; + CompleteTypeDetail detail_SecondLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SecondLevelElement, ann_custom_SecondLevelElement, type_name_SecondLevelElement.to_string()); + CompleteStructHeader header_SecondLevelElement; + header_SecondLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SecondLevelElement); + CompleteStructMemberSeq member_seq_SecondLevelElement; + { + TypeIdentifierPair type_ids_an_element_alone; + ReturnCode_t return_code_an_element_alone {eprosima::fastdds::dds::RETCODE_OK}; + return_code_an_element_alone = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_an_element_alone); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_an_element_alone) + { + ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); + } + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_an_element_alone = 0x00000000; + bool common_an_element_alone_ec {false}; + CommonStructMember common_an_element_alone {TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_an_element_alone, common_an_element_alone_ec))}; + if (!common_an_element_alone_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure an_element_alone member TypeIdentifier inconsistent."); + return; + } + MemberName name_an_element_alone = "an_element_alone"; + eprosima::fastcdr::optional member_ann_builtin_an_element_alone; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_SecondLevelElement); + CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_an_element_alone); + } + { + TypeIdentifierPair type_ids_a_limited_other_value; + ReturnCode_t return_code_a_limited_other_value {eprosima::fastdds::dds::RETCODE_OK}; + return_code_a_limited_other_value = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_ThirdLevelElement_1", type_ids_a_limited_other_value); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_a_limited_other_value) + { + return_code_a_limited_other_value = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_a_limited_other_value); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_a_limited_other_value) + { + ::register_ThirdLevelElement_type_identifier(type_ids_a_limited_other_value); + } + bool element_identifier_anonymous_sequence_ThirdLevelElement_1_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_ThirdLevelElement_1 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_a_limited_other_value, element_identifier_anonymous_sequence_ThirdLevelElement_1_ec))}; + if (!element_identifier_anonymous_sequence_ThirdLevelElement_1_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_COMPLETE; + if (TK_NONE == type_ids_a_limited_other_value.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_ThirdLevelElement_1 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_ThirdLevelElement_1 = 0; + PlainCollectionHeader header_anonymous_sequence_ThirdLevelElement_1 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_ThirdLevelElement_1, element_flags_anonymous_sequence_ThirdLevelElement_1); + { + SBound bound = static_cast(1); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_ThirdLevelElement_1, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_ThirdLevelElement_1)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_ThirdLevelElement_1", type_ids_a_limited_other_value)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_ThirdLevelElement_1 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_a_limited_other_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_a_limited_other_value = 0x00000001; + bool common_a_limited_other_value_ec {false}; + CommonStructMember common_a_limited_other_value {TypeObjectUtils::build_common_struct_member(member_id_a_limited_other_value, member_flags_a_limited_other_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_a_limited_other_value, common_a_limited_other_value_ec))}; + if (!common_a_limited_other_value_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure a_limited_other_value member TypeIdentifier inconsistent."); + return; + } + MemberName name_a_limited_other_value = "a_limited_other_value"; + eprosima::fastcdr::optional member_ann_builtin_a_limited_other_value; + ann_custom_SecondLevelElement.reset(); + CompleteMemberDetail detail_a_limited_other_value = TypeObjectUtils::build_complete_member_detail(name_a_limited_other_value, member_ann_builtin_a_limited_other_value, ann_custom_SecondLevelElement); + CompleteStructMember member_a_limited_other_value = TypeObjectUtils::build_complete_struct_member(common_a_limited_other_value, detail_a_limited_other_value); + TypeObjectUtils::add_complete_struct_member(member_seq_SecondLevelElement, member_a_limited_other_value); + } + CompleteStructType struct_type_SecondLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_SecondLevelElement, header_SecondLevelElement, member_seq_SecondLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SecondLevelElement, type_name_SecondLevelElement.to_string(), type_ids_SecondLevelElement)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "SecondLevelElement already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_FirstLevelElement_type_identifier( + TypeIdentifierPair& type_ids_FirstLevelElement) +{ + + ReturnCode_t return_code_FirstLevelElement {eprosima::fastdds::dds::RETCODE_OK}; + return_code_FirstLevelElement = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "FirstLevelElement", type_ids_FirstLevelElement); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_FirstLevelElement) + { + StructTypeFlag struct_flags_FirstLevelElement = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_FirstLevelElement = "FirstLevelElement"; + eprosima::fastcdr::optional type_ann_builtin_FirstLevelElement; + eprosima::fastcdr::optional ann_custom_FirstLevelElement; + CompleteTypeDetail detail_FirstLevelElement = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_FirstLevelElement, ann_custom_FirstLevelElement, type_name_FirstLevelElement.to_string()); + CompleteStructHeader header_FirstLevelElement; + header_FirstLevelElement = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_FirstLevelElement); + CompleteStructMemberSeq member_seq_FirstLevelElement; + { + TypeIdentifierPair type_ids_useless_name; + ReturnCode_t return_code_useless_name {eprosima::fastdds::dds::RETCODE_OK}; + return_code_useless_name = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_useless_name); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_useless_name) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_useless_name)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_useless_name = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_useless_name = 0x00000000; + bool common_useless_name_ec {false}; + CommonStructMember common_useless_name {TypeObjectUtils::build_common_struct_member(member_id_useless_name, member_flags_useless_name, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_useless_name, common_useless_name_ec))}; + if (!common_useless_name_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure useless_name member TypeIdentifier inconsistent."); + return; + } + MemberName name_useless_name = "useless_name"; + eprosima::fastcdr::optional member_ann_builtin_useless_name; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_useless_name = TypeObjectUtils::build_complete_member_detail(name_useless_name, member_ann_builtin_useless_name, ann_custom_FirstLevelElement); + CompleteStructMember member_useless_name = TypeObjectUtils::build_complete_struct_member(common_useless_name, detail_useless_name); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_useless_name); + } + { + TypeIdentifierPair type_ids_sub; + ReturnCode_t return_code_sub {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sub = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_SecondLevelElement_unbounded", type_ids_sub); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub) + { + return_code_sub = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "SecondLevelElement", type_ids_sub); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sub) + { + ::register_SecondLevelElement_type_identifier(type_ids_sub); + } + bool element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_SecondLevelElement_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub, element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_SecondLevelElement_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_sub.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_SecondLevelElement_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_SecondLevelElement_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_SecondLevelElement_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_SecondLevelElement_unbounded, element_flags_anonymous_sequence_SecondLevelElement_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_SecondLevelElement_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_SecondLevelElement_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_SecondLevelElement_unbounded", type_ids_sub)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_SecondLevelElement_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_sub = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_sub = 0x00000001; + bool common_sub_ec {false}; + CommonStructMember common_sub {TypeObjectUtils::build_common_struct_member(member_id_sub, member_flags_sub, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sub, common_sub_ec))}; + if (!common_sub_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sub member TypeIdentifier inconsistent."); + return; + } + MemberName name_sub = "sub"; + eprosima::fastcdr::optional member_ann_builtin_sub; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_sub = TypeObjectUtils::build_complete_member_detail(name_sub, member_ann_builtin_sub, ann_custom_FirstLevelElement); + CompleteStructMember member_sub = TypeObjectUtils::build_complete_struct_member(common_sub, detail_sub); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_sub); + } + { + TypeIdentifierPair type_ids_an_element_alone; + ReturnCode_t return_code_an_element_alone {eprosima::fastdds::dds::RETCODE_OK}; + return_code_an_element_alone = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "ThirdLevelElement", type_ids_an_element_alone); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_an_element_alone) + { + ::register_ThirdLevelElement_type_identifier(type_ids_an_element_alone); + } + StructMemberFlag member_flags_an_element_alone = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_an_element_alone = 0x00000002; + bool common_an_element_alone_ec {false}; + CommonStructMember common_an_element_alone {TypeObjectUtils::build_common_struct_member(member_id_an_element_alone, member_flags_an_element_alone, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_an_element_alone, common_an_element_alone_ec))}; + if (!common_an_element_alone_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure an_element_alone member TypeIdentifier inconsistent."); + return; + } + MemberName name_an_element_alone = "an_element_alone"; + eprosima::fastcdr::optional member_ann_builtin_an_element_alone; + ann_custom_FirstLevelElement.reset(); + CompleteMemberDetail detail_an_element_alone = TypeObjectUtils::build_complete_member_detail(name_an_element_alone, member_ann_builtin_an_element_alone, ann_custom_FirstLevelElement); + CompleteStructMember member_an_element_alone = TypeObjectUtils::build_complete_struct_member(common_an_element_alone, detail_an_element_alone); + TypeObjectUtils::add_complete_struct_member(member_seq_FirstLevelElement, member_an_element_alone); + } + CompleteStructType struct_type_FirstLevelElement = TypeObjectUtils::build_complete_struct_type(struct_flags_FirstLevelElement, header_FirstLevelElement, member_seq_FirstLevelElement); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_FirstLevelElement, type_name_FirstLevelElement.to_string(), type_ids_FirstLevelElement)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "FirstLevelElement already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_complex_nested_arrays_type_identifier( + TypeIdentifierPair& type_ids_complex_nested_arrays) +{ + + ReturnCode_t return_code_complex_nested_arrays {eprosima::fastdds::dds::RETCODE_OK}; + return_code_complex_nested_arrays = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "complex_nested_arrays", type_ids_complex_nested_arrays); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_complex_nested_arrays) + { + StructTypeFlag struct_flags_complex_nested_arrays = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_complex_nested_arrays = "complex_nested_arrays"; + eprosima::fastcdr::optional type_ann_builtin_complex_nested_arrays; + eprosima::fastcdr::optional ann_custom_complex_nested_arrays; + CompleteTypeDetail detail_complex_nested_arrays = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_complex_nested_arrays, ann_custom_complex_nested_arrays, type_name_complex_nested_arrays.to_string()); + CompleteStructHeader header_complex_nested_arrays; + header_complex_nested_arrays = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_complex_nested_arrays); + CompleteStructMemberSeq member_seq_complex_nested_arrays; + { + TypeIdentifierPair type_ids_array_of_elements; + ReturnCode_t return_code_array_of_elements {eprosima::fastdds::dds::RETCODE_OK}; + return_code_array_of_elements = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_FirstLevelElement_3", type_ids_array_of_elements); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_array_of_elements) + { + return_code_array_of_elements = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "FirstLevelElement", type_ids_array_of_elements); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_array_of_elements) + { + ::register_FirstLevelElement_type_identifier(type_ids_array_of_elements); + } + bool element_identifier_anonymous_array_FirstLevelElement_3_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_FirstLevelElement_3 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_array_of_elements, element_identifier_anonymous_array_FirstLevelElement_3_ec))}; + if (!element_identifier_anonymous_array_FirstLevelElement_3_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_FirstLevelElement_3 = EK_COMPLETE; + if (TK_NONE == type_ids_array_of_elements.type_identifier2()._d()) + { + equiv_kind_anonymous_array_FirstLevelElement_3 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_FirstLevelElement_3 = 0; + PlainCollectionHeader header_anonymous_array_FirstLevelElement_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_FirstLevelElement_3, element_flags_anonymous_array_FirstLevelElement_3); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_FirstLevelElement_3, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_FirstLevelElement_3)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_FirstLevelElement_3", type_ids_array_of_elements)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_FirstLevelElement_3 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_array_of_elements = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_array_of_elements = 0x00000000; + bool common_array_of_elements_ec {false}; + CommonStructMember common_array_of_elements {TypeObjectUtils::build_common_struct_member(member_id_array_of_elements, member_flags_array_of_elements, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_array_of_elements, common_array_of_elements_ec))}; + if (!common_array_of_elements_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure array_of_elements member TypeIdentifier inconsistent."); + return; + } + MemberName name_array_of_elements = "array_of_elements"; + eprosima::fastcdr::optional member_ann_builtin_array_of_elements; + ann_custom_complex_nested_arrays.reset(); + CompleteMemberDetail detail_array_of_elements = TypeObjectUtils::build_complete_member_detail(name_array_of_elements, member_ann_builtin_array_of_elements, ann_custom_complex_nested_arrays); + CompleteStructMember member_array_of_elements = TypeObjectUtils::build_complete_struct_member(common_array_of_elements, detail_array_of_elements); + TypeObjectUtils::add_complete_struct_member(member_seq_complex_nested_arrays, member_array_of_elements); + } + CompleteStructType struct_type_complex_nested_arrays = TypeObjectUtils::build_complete_struct_type(struct_flags_complex_nested_arrays, header_complex_nested_arrays, member_seq_complex_nested_arrays); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_complex_nested_arrays, type_name_complex_nested_arrays.to_string(), type_ids_complex_nested_arrays)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "complex_nested_arrays already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp new file mode 100644 index 00000000..aec5bb21 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/complex_nested_arraysTypeObjectSupport.hpp @@ -0,0 +1,92 @@ +// 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 complex_nested_arraysTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_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 + +/** + * @brief Register ThirdLevelElement related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_ThirdLevelElement_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); +/** + * @brief Register SecondLevelElement related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_SecondLevelElement_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); +/** + * @brief Register FirstLevelElement related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_FirstLevelElement_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); +/** + * @brief Register complex_nested_arrays related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_complex_nested_arrays_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__COMPLEX_NESTED_ARRAYS_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp new file mode 100644 index 00000000..641f52d9 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequence.hpp @@ -0,0 +1,190 @@ +// 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 float_bounded_sequence.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_HPP + +#include +#include +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(FLOAT_BOUNDED_SEQUENCE_SOURCE) +#define FLOAT_BOUNDED_SEQUENCE_DllAPI __declspec( dllexport ) +#else +#define FLOAT_BOUNDED_SEQUENCE_DllAPI __declspec( dllimport ) +#endif // FLOAT_BOUNDED_SEQUENCE_SOURCE +#else +#define FLOAT_BOUNDED_SEQUENCE_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define FLOAT_BOUNDED_SEQUENCE_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure float_bounded_sequence defined by the user in the IDL file. + * @ingroup float_bounded_sequence + */ +class float_bounded_sequence +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport float_bounded_sequence() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~float_bounded_sequence() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object float_bounded_sequence that will be copied. + */ + eProsima_user_DllExport float_bounded_sequence( + const float_bounded_sequence& x) + { + m_numbers = x.m_numbers; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object float_bounded_sequence that will be copied. + */ + eProsima_user_DllExport float_bounded_sequence( + float_bounded_sequence&& x) noexcept + { + m_numbers = std::move(x.m_numbers); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object float_bounded_sequence that will be copied. + */ + eProsima_user_DllExport float_bounded_sequence& operator =( + const float_bounded_sequence& x) + { + + m_numbers = x.m_numbers; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object float_bounded_sequence that will be copied. + */ + eProsima_user_DllExport float_bounded_sequence& operator =( + float_bounded_sequence&& x) noexcept + { + + m_numbers = std::move(x.m_numbers); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x float_bounded_sequence object to compare. + */ + eProsima_user_DllExport bool operator ==( + const float_bounded_sequence& x) const + { + return (m_numbers == x.m_numbers); + } + + /*! + * @brief Comparison operator. + * @param x float_bounded_sequence object to compare. + */ + eProsima_user_DllExport bool operator !=( + const float_bounded_sequence& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member numbers + * @param _numbers New value to be copied in member numbers + */ + eProsima_user_DllExport void numbers( + const std::vector& _numbers) + { + m_numbers = _numbers; + } + + /*! + * @brief This function moves the value in member numbers + * @param _numbers New value to be moved in member numbers + */ + eProsima_user_DllExport void numbers( + std::vector&& _numbers) + { + m_numbers = std::move(_numbers); + } + + /*! + * @brief This function returns a constant reference to member numbers + * @return Constant reference to member numbers + */ + eProsima_user_DllExport const std::vector& numbers() const + { + return m_numbers; + } + + /*! + * @brief This function returns a reference to member numbers + * @return Reference to member numbers + */ + eProsima_user_DllExport std::vector& numbers() + { + return m_numbers; + } + + + +private: + + std::vector m_numbers; + +}; + +#endif // _FAST_DDS_GENERATED_FLOAT_BOUNDED_SEQUENCE_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp new file mode 100644 index 00000000..d41f390b --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.hpp @@ -0,0 +1,46 @@ +// 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 float_bounded_sequenceCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP + +#include "float_bounded_sequence.hpp" + +constexpr uint32_t float_bounded_sequence_max_cdr_typesize {60UL}; +constexpr uint32_t float_bounded_sequence_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const float_bounded_sequence& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp new file mode 100644 index 00000000..59ec9e74 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceCdrAux.ipp @@ -0,0 +1,121 @@ +// 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 float_bounded_sequenceCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP + +#include "float_bounded_sequenceCdrAux.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 float_bounded_sequence& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.numbers(), 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 float_bounded_sequence& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.numbers() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + float_bounded_sequence& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.numbers(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const float_bounded_sequence& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.numbers(); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCECDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx new file mode 100644 index 00000000..5381942f --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.cxx @@ -0,0 +1,217 @@ +// 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 float_bounded_sequencePubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "float_bounded_sequencePubSubTypes.hpp" + +#include +#include + +#include "float_bounded_sequenceCdrAux.hpp" +#include "float_bounded_sequenceTypeObjectSupport.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; + +float_bounded_sequencePubSubType::float_bounded_sequencePubSubType() +{ + set_name("float_bounded_sequence"); + uint32_t type_size = float_bounded_sequence_max_cdr_typesize; + 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; + uint32_t key_length = float_bounded_sequence_max_key_cdr_typesize > 16 ? float_bounded_sequence_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +float_bounded_sequencePubSubType::~float_bounded_sequencePubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool float_bounded_sequencePubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const float_bounded_sequence* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool float_bounded_sequencePubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + float_bounded_sequence* 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; +} + +uint32_t float_bounded_sequencePubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* float_bounded_sequencePubSubType::create_data() +{ + return reinterpret_cast(new float_bounded_sequence()); +} + +void float_bounded_sequencePubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool float_bounded_sequencePubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + float_bounded_sequence data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool float_bounded_sequencePubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const float_bounded_sequence* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + float_bounded_sequence_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || float_bounded_sequence_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void float_bounded_sequencePubSubType::register_type_object_representation() +{ + register_float_bounded_sequence_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "float_bounded_sequenceCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp new file mode 100644 index 00000000..f4529c6a --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequencePubSubTypes.hpp @@ -0,0 +1,123 @@ +// 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 float_bounded_sequencePubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "float_bounded_sequence.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated float_bounded_sequence is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type float_bounded_sequence defined by the user in the IDL file. + * @ingroup float_bounded_sequence + */ +class float_bounded_sequencePubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef float_bounded_sequence type; + + eProsima_user_DllExport float_bounded_sequencePubSubType(); + + eProsima_user_DllExport ~float_bounded_sequencePubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx new file mode 100644 index 00000000..aa6108f6 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.cxx @@ -0,0 +1,132 @@ +// 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 float_bounded_sequenceTypeObjectSupport.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. + */ + +#include "float_bounded_sequenceTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "float_bounded_sequence.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_float_bounded_sequence_type_identifier( + TypeIdentifierPair& type_ids_float_bounded_sequence) +{ + + ReturnCode_t return_code_float_bounded_sequence {eprosima::fastdds::dds::RETCODE_OK}; + return_code_float_bounded_sequence = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "float_bounded_sequence", type_ids_float_bounded_sequence); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_float_bounded_sequence) + { + StructTypeFlag struct_flags_float_bounded_sequence = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_float_bounded_sequence = "float_bounded_sequence"; + eprosima::fastcdr::optional type_ann_builtin_float_bounded_sequence; + eprosima::fastcdr::optional ann_custom_float_bounded_sequence; + CompleteTypeDetail detail_float_bounded_sequence = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_float_bounded_sequence, ann_custom_float_bounded_sequence, type_name_float_bounded_sequence.to_string()); + CompleteStructHeader header_float_bounded_sequence; + header_float_bounded_sequence = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_float_bounded_sequence); + CompleteStructMemberSeq member_seq_float_bounded_sequence; + { + TypeIdentifierPair type_ids_numbers; + ReturnCode_t return_code_numbers {eprosima::fastdds::dds::RETCODE_OK}; + return_code_numbers = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_float_13", type_ids_numbers); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_numbers) + { + return_code_numbers = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_numbers); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_numbers) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_sequence_float_13_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_float_13 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_numbers, element_identifier_anonymous_sequence_float_13_ec))}; + if (!element_identifier_anonymous_sequence_float_13_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_float_13 = EK_COMPLETE; + if (TK_NONE == type_ids_numbers.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_float_13 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_float_13 = 0; + PlainCollectionHeader header_anonymous_sequence_float_13 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_float_13, element_flags_anonymous_sequence_float_13); + { + SBound bound = static_cast(13); + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_float_13, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_float_13)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_float_13", type_ids_numbers)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_float_13 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_numbers = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_numbers = 0x00000000; + bool common_numbers_ec {false}; + CommonStructMember common_numbers {TypeObjectUtils::build_common_struct_member(member_id_numbers, member_flags_numbers, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_numbers, common_numbers_ec))}; + if (!common_numbers_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure numbers member TypeIdentifier inconsistent."); + return; + } + MemberName name_numbers = "numbers"; + eprosima::fastcdr::optional member_ann_builtin_numbers; + ann_custom_float_bounded_sequence.reset(); + CompleteMemberDetail detail_numbers = TypeObjectUtils::build_complete_member_detail(name_numbers, member_ann_builtin_numbers, ann_custom_float_bounded_sequence); + CompleteStructMember member_numbers = TypeObjectUtils::build_complete_struct_member(common_numbers, detail_numbers); + TypeObjectUtils::add_complete_struct_member(member_seq_float_bounded_sequence, member_numbers); + } + CompleteStructType struct_type_float_bounded_sequence = TypeObjectUtils::build_complete_struct_type(struct_flags_float_bounded_sequence, header_float_bounded_sequence, member_seq_float_bounded_sequence); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_float_bounded_sequence, type_name_float_bounded_sequence.to_string(), type_ids_float_bounded_sequence)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "float_bounded_sequence already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp new file mode 100644 index 00000000..78dab6b6 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/float_bounded_sequenceTypeObjectSupport.hpp @@ -0,0 +1,56 @@ +// 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 float_bounded_sequenceTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_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 + +/** + * @brief Register float_bounded_sequence related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_float_bounded_sequence_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__FLOAT_BOUNDED_SEQUENCE_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp new file mode 100644 index 00000000..27ca777d --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_world.hpp @@ -0,0 +1,227 @@ +// 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 hello_world.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__HELLO_WORLD_HPP +#define FAST_DDS_GENERATED__HELLO_WORLD_HPP + +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(HELLO_WORLD_SOURCE) +#define HELLO_WORLD_DllAPI __declspec( dllexport ) +#else +#define HELLO_WORLD_DllAPI __declspec( dllimport ) +#endif // HELLO_WORLD_SOURCE +#else +#define HELLO_WORLD_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define HELLO_WORLD_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure hello_world defined by the user in the IDL file. + * @ingroup hello_world + */ +class hello_world +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport hello_world() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~hello_world() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object hello_world that will be copied. + */ + eProsima_user_DllExport hello_world( + const hello_world& x) + { + m_index = x.m_index; + + m_message = x.m_message; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object hello_world that will be copied. + */ + eProsima_user_DllExport hello_world( + hello_world&& x) noexcept + { + m_index = x.m_index; + m_message = std::move(x.m_message); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object hello_world that will be copied. + */ + eProsima_user_DllExport hello_world& operator =( + const hello_world& x) + { + + m_index = x.m_index; + + m_message = x.m_message; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object hello_world that will be copied. + */ + eProsima_user_DllExport hello_world& operator =( + hello_world&& x) noexcept + { + + m_index = x.m_index; + m_message = std::move(x.m_message); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x hello_world object to compare. + */ + eProsima_user_DllExport bool operator ==( + const hello_world& x) const + { + return (m_index == x.m_index && + m_message == x.m_message); + } + + /*! + * @brief Comparison operator. + * @param x hello_world object to compare. + */ + eProsima_user_DllExport bool operator !=( + const hello_world& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + eProsima_user_DllExport void index( + uint32_t _index) + { + m_index = _index; + } + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } + + + /*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ + eProsima_user_DllExport void message( + const std::string& _message) + { + m_message = _message; + } + + /*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ + eProsima_user_DllExport void message( + std::string&& _message) + { + m_message = std::move(_message); + } + + /*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ + eProsima_user_DllExport const std::string& message() const + { + return m_message; + } + + /*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ + eProsima_user_DllExport std::string& message() + { + return m_message; + } + + + +private: + + uint32_t m_index{0}; + std::string m_message; + +}; + +#endif // _FAST_DDS_GENERATED_HELLO_WORLD_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp new file mode 100644 index 00000000..4837eee8 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.hpp @@ -0,0 +1,46 @@ +// 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 hello_worldCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP +#define FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP + +#include "hello_world.hpp" + +constexpr uint32_t hello_world_max_cdr_typesize {268UL}; +constexpr uint32_t hello_world_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const hello_world& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp new file mode 100644 index 00000000..689099b3 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldCdrAux.ipp @@ -0,0 +1,131 @@ +// 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 hello_worldCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP +#define FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP + +#include "hello_worldCdrAux.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 hello_world& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.index(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.message(), 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 hello_world& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.index() + << eprosima::fastcdr::MemberId(1) << data.message() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + hello_world& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.index(); + break; + + case 1: + dcdr >> data.message(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const hello_world& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.index(); + + scdr << data.message(); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__HELLO_WORLDCDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx new file mode 100644 index 00000000..98a314b3 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.cxx @@ -0,0 +1,217 @@ +// 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 hello_worldPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "hello_worldPubSubTypes.hpp" + +#include +#include + +#include "hello_worldCdrAux.hpp" +#include "hello_worldTypeObjectSupport.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; + +hello_worldPubSubType::hello_worldPubSubType() +{ + set_name("hello_world"); + uint32_t type_size = hello_world_max_cdr_typesize; + 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; + uint32_t key_length = hello_world_max_key_cdr_typesize > 16 ? hello_world_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +hello_worldPubSubType::~hello_worldPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool hello_worldPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const hello_world* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool hello_worldPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + hello_world* 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; +} + +uint32_t hello_worldPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* hello_worldPubSubType::create_data() +{ + return reinterpret_cast(new hello_world()); +} + +void hello_worldPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool hello_worldPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + hello_world data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool hello_worldPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const hello_world* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + hello_world_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || hello_world_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void hello_worldPubSubType::register_type_object_representation() +{ + register_hello_world_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "hello_worldCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp new file mode 100644 index 00000000..660a72a8 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldPubSubTypes.hpp @@ -0,0 +1,123 @@ +// 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 hello_worldPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "hello_world.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated hello_world is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type hello_world defined by the user in the IDL file. + * @ingroup hello_world + */ +class hello_worldPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef hello_world type; + + eProsima_user_DllExport hello_worldPubSubType(); + + eProsima_user_DllExport ~hello_worldPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__HELLO_WORLD_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx new file mode 100644 index 00000000..1c19ab81 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.cxx @@ -0,0 +1,138 @@ +// 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 hello_worldTypeObjectSupport.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. + */ + +#include "hello_worldTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hello_world.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_hello_world_type_identifier( + TypeIdentifierPair& type_ids_hello_world) +{ + + ReturnCode_t return_code_hello_world {eprosima::fastdds::dds::RETCODE_OK}; + return_code_hello_world = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "hello_world", type_ids_hello_world); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_hello_world) + { + StructTypeFlag struct_flags_hello_world = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_hello_world = "hello_world"; + eprosima::fastcdr::optional type_ann_builtin_hello_world; + eprosima::fastcdr::optional ann_custom_hello_world; + CompleteTypeDetail detail_hello_world = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_hello_world, ann_custom_hello_world, type_name_hello_world.to_string()); + CompleteStructHeader header_hello_world; + header_hello_world = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_hello_world); + CompleteStructMemberSeq member_seq_hello_world; + { + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_index); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_index = 0x00000000; + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_hello_world.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_hello_world); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_hello_world, member_index); + } + { + TypeIdentifierPair type_ids_message; + ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK}; + return_code_message = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_message); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_message)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_message = 0x00000001; + bool common_message_ec {false}; + CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))}; + if (!common_message_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent."); + return; + } + MemberName name_message = "message"; + eprosima::fastcdr::optional member_ann_builtin_message; + ann_custom_hello_world.reset(); + CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_hello_world); + CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message); + TypeObjectUtils::add_complete_struct_member(member_seq_hello_world, member_message); + } + CompleteStructType struct_type_hello_world = TypeObjectUtils::build_complete_struct_type(struct_flags_hello_world, header_hello_world, member_seq_hello_world); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_hello_world, type_name_hello_world.to_string(), type_ids_hello_world)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "hello_world already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp new file mode 100644 index 00000000..d0a80dd8 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/hello_worldTypeObjectSupport.hpp @@ -0,0 +1,56 @@ +// 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 hello_worldTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__HELLO_WORLD_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 + +/** + * @brief Register hello_world related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_hello_world_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__HELLO_WORLD_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp new file mode 100644 index 00000000..a78917ad --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_array.hpp @@ -0,0 +1,189 @@ +// 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 numeric_array.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAY_HPP + +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(NUMERIC_ARRAY_SOURCE) +#define NUMERIC_ARRAY_DllAPI __declspec( dllexport ) +#else +#define NUMERIC_ARRAY_DllAPI __declspec( dllimport ) +#endif // NUMERIC_ARRAY_SOURCE +#else +#define NUMERIC_ARRAY_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define NUMERIC_ARRAY_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure numeric_array defined by the user in the IDL file. + * @ingroup numeric_array + */ +class numeric_array +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport numeric_array() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~numeric_array() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object numeric_array that will be copied. + */ + eProsima_user_DllExport numeric_array( + const numeric_array& x) + { + m_points = x.m_points; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object numeric_array that will be copied. + */ + eProsima_user_DllExport numeric_array( + numeric_array&& x) noexcept + { + m_points = std::move(x.m_points); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object numeric_array that will be copied. + */ + eProsima_user_DllExport numeric_array& operator =( + const numeric_array& x) + { + + m_points = x.m_points; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object numeric_array that will be copied. + */ + eProsima_user_DllExport numeric_array& operator =( + numeric_array&& x) noexcept + { + + m_points = std::move(x.m_points); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x numeric_array object to compare. + */ + eProsima_user_DllExport bool operator ==( + const numeric_array& x) const + { + return (m_points == x.m_points); + } + + /*! + * @brief Comparison operator. + * @param x numeric_array object to compare. + */ + eProsima_user_DllExport bool operator !=( + const numeric_array& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member points + * @param _points New value to be copied in member points + */ + eProsima_user_DllExport void points( + const std::array& _points) + { + m_points = _points; + } + + /*! + * @brief This function moves the value in member points + * @param _points New value to be moved in member points + */ + eProsima_user_DllExport void points( + std::array&& _points) + { + m_points = std::move(_points); + } + + /*! + * @brief This function returns a constant reference to member points + * @return Constant reference to member points + */ + eProsima_user_DllExport const std::array& points() const + { + return m_points; + } + + /*! + * @brief This function returns a reference to member points + * @return Reference to member points + */ + eProsima_user_DllExport std::array& points() + { + return m_points; + } + + + +private: + + std::array m_points{0}; + +}; + +#endif // _FAST_DDS_GENERATED_NUMERIC_ARRAY_HPP_ + + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp new file mode 100644 index 00000000..a00c7007 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.hpp @@ -0,0 +1,46 @@ +// 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 numeric_arrayCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP + +#include "numeric_array.hpp" + +constexpr uint32_t numeric_array_max_cdr_typesize {16UL}; +constexpr uint32_t numeric_array_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const numeric_array& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp new file mode 100644 index 00000000..f7363c3a --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayCdrAux.ipp @@ -0,0 +1,121 @@ +// 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 numeric_arrayCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP + +#include "numeric_arrayCdrAux.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 numeric_array& data, + size_t& current_alignment) +{ + 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::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.points(), 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 numeric_array& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.points() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + numeric_array& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_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.points(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const numeric_array& data) +{ + + static_cast(scdr); + static_cast(data); + scdr << data.points(); + +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAYCDRAUX_IPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx new file mode 100644 index 00000000..736b1168 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.cxx @@ -0,0 +1,217 @@ +// 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 numeric_arrayPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "numeric_arrayPubSubTypes.hpp" + +#include +#include + +#include "numeric_arrayCdrAux.hpp" +#include "numeric_arrayTypeObjectSupport.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; + +numeric_arrayPubSubType::numeric_arrayPubSubType() +{ + set_name("numeric_array"); + uint32_t type_size = numeric_array_max_cdr_typesize; + 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; + uint32_t key_length = numeric_array_max_key_cdr_typesize > 16 ? numeric_array_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +numeric_arrayPubSubType::~numeric_arrayPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool numeric_arrayPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const numeric_array* 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::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool numeric_arrayPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + numeric_array* 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; +} + +uint32_t numeric_arrayPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + 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; + } +} + +void* numeric_arrayPubSubType::create_data() +{ + return reinterpret_cast(new numeric_array()); +} + +void numeric_arrayPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool numeric_arrayPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + numeric_array data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool numeric_arrayPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const numeric_array* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + numeric_array_max_key_cdr_typesize); + + // Object that serializes the data. + 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 || numeric_array_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void numeric_arrayPubSubType::register_type_object_representation() +{ + register_numeric_array_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "numeric_arrayCdrAux.ipp" diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp new file mode 100644 index 00000000..3f8dce29 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayPubSubTypes.hpp @@ -0,0 +1,123 @@ +// 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 numeric_arrayPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "numeric_array.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated numeric_array is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type numeric_array defined by the user in the IDL file. + * @ingroup numeric_array + */ +class numeric_arrayPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef numeric_array type; + + eProsima_user_DllExport numeric_arrayPubSubType(); + + eProsima_user_DllExport ~numeric_arrayPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAY_PUBSUBTYPES_HPP + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx new file mode 100644 index 00000000..22b35f27 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.cxx @@ -0,0 +1,134 @@ +// 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 numeric_arrayTypeObjectSupport.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. + */ + +#include "numeric_arrayTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "numeric_array.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_numeric_array_type_identifier( + TypeIdentifierPair& type_ids_numeric_array) +{ + + ReturnCode_t return_code_numeric_array {eprosima::fastdds::dds::RETCODE_OK}; + return_code_numeric_array = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "numeric_array", type_ids_numeric_array); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_numeric_array) + { + StructTypeFlag struct_flags_numeric_array = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_numeric_array = "numeric_array"; + eprosima::fastcdr::optional type_ann_builtin_numeric_array; + eprosima::fastcdr::optional ann_custom_numeric_array; + CompleteTypeDetail detail_numeric_array = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_numeric_array, ann_custom_numeric_array, type_name_numeric_array.to_string()); + CompleteStructHeader header_numeric_array; + header_numeric_array = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_numeric_array); + CompleteStructMemberSeq member_seq_numeric_array; + { + TypeIdentifierPair type_ids_points; + ReturnCode_t return_code_points {eprosima::fastdds::dds::RETCODE_OK}; + return_code_points = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_int32_t_3", type_ids_points); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_points) + { + return_code_points = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_points); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_points) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_array_int32_t_3_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_int32_t_3 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_points, element_identifier_anonymous_array_int32_t_3_ec))}; + if (!element_identifier_anonymous_array_int32_t_3_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_int32_t_3 = EK_COMPLETE; + if (TK_NONE == type_ids_points.type_identifier2()._d()) + { + equiv_kind_anonymous_array_int32_t_3 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_int32_t_3 = 0; + PlainCollectionHeader header_anonymous_array_int32_t_3 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_int32_t_3, element_flags_anonymous_array_int32_t_3); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(3)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_int32_t_3, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_int32_t_3)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_int32_t_3", type_ids_points)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_int32_t_3 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_points = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_points = 0x00000000; + bool common_points_ec {false}; + CommonStructMember common_points {TypeObjectUtils::build_common_struct_member(member_id_points, member_flags_points, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_points, common_points_ec))}; + if (!common_points_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure points member TypeIdentifier inconsistent."); + return; + } + MemberName name_points = "points"; + eprosima::fastcdr::optional member_ann_builtin_points; + ann_custom_numeric_array.reset(); + CompleteMemberDetail detail_points = TypeObjectUtils::build_complete_member_detail(name_points, member_ann_builtin_points, ann_custom_numeric_array); + CompleteStructMember member_points = TypeObjectUtils::build_complete_struct_member(common_points, detail_points); + TypeObjectUtils::add_complete_struct_member(member_seq_numeric_array, member_points); + } + CompleteStructType struct_type_numeric_array = TypeObjectUtils::build_complete_struct_type(struct_flags_numeric_array, header_numeric_array, member_seq_numeric_array); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_numeric_array, type_name_numeric_array.to_string(), type_ids_numeric_array)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "numeric_array already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp new file mode 100644 index 00000000..b6219fd7 --- /dev/null +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/type_objects/numeric_arrayTypeObjectSupport.hpp @@ -0,0 +1,56 @@ +// 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 numeric_arrayTypeObjectSupport.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. + */ + +#ifndef FAST_DDS_GENERATED__NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__NUMERIC_ARRAY_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 + +/** + * @brief Register numeric_array related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_numeric_array_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__NUMERIC_ARRAY_TYPE_OBJECT_SUPPORT_HPP diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index 8ea9d262..a53f4633 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -19,6 +19,7 @@ #pragma once #include +#include #include @@ -41,7 +42,7 @@ namespace ddspipe { namespace participants { /** - * Simple RTPS Participant responsible for registering discovered types + * Simple RTPS Participant able to route dynamic types in addition to user data. * */ class DynTypesParticipant : public rtps::SimpleParticipant @@ -58,9 +59,6 @@ class DynTypesParticipant : public rtps::SimpleParticipant DDSPIPE_PARTICIPANTS_DllAPI ~DynTypesParticipant(); - DDSPIPE_PARTICIPANTS_DllAPI - virtual void init() override; - /** * @brief Create a writer object * @@ -97,10 +95,13 @@ class DynTypesParticipant : public rtps::SimpleParticipant void notify_type_discovered_( const fastdds::dds::xtypes::TypeInformation& type_info, - const fastcdr::string_255& type_name); + const std::string& type_name); //! Type Object Internal Reader std::shared_ptr type_object_reader_; + + //! Received types set + std::set received_types_; }; } /* namespace participants */ diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp index 36cccdce..76a0d016 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/ISchemaHandler.hpp @@ -39,8 +39,7 @@ class ISchemaHandler virtual void add_schema( const fastdds::dds::DynamicType::_ref_type& dynamic_type, - const std::string& type_name, - const fastdds::dds::xtypes::TypeIdentifier& type_id) = 0; + const fastdds::dds::xtypes::TypeIdentifier& type_identifier) = 0; virtual void add_data( const core::types::DdsTopic& topic, diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index ca6a1fe5..cafa3aa7 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -269,7 +269,7 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener static fastdds::rtps::ReaderAttributes reckon_reader_attributes_( const core::types::DdsTopic& topic) noexcept; - //! TODO + //! Topic Description to create RTPS Reader fastdds::rtps::TopicDescription reckon_topic_description_( const core::types::DdsTopic& topic) noexcept; @@ -321,7 +321,7 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener //! Reader attributes to create the internal RTPS Reader. fastdds::rtps::ReaderAttributes reader_attributes_; - //! Topic attributes to create the internal RTPS Reader. + //! Topic description to create the internal RTPS Reader. fastdds::rtps::TopicDescription topic_description_; //! Reader QoS to create the internal RTPS Reader. diff --git a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp index 538df020..6e5c0ab0 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/dds/TopicDataType.hpp @@ -47,7 +47,7 @@ class TopicDataType : public fastdds::dds::TopicDataType TopicDataType( const std::shared_ptr& payload_pool, const std::string& type_name, - const fastdds::dds::xtypes::TypeIdentifierPair& type_ids, + const fastdds::dds::xtypes::TypeIdentifierPair& type_identifiers, const bool keyed); //! Default destructor diff --git a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp index e48be2c5..1bb98a1b 100644 --- a/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp +++ b/ddspipe_participants/include/ddspipe_participants/writer/rtps/CommonWriter.hpp @@ -246,7 +246,7 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener static fastdds::rtps::WriterAttributes reckon_writer_attributes_( const core::types::DdsTopic& topic) noexcept; - //! TODO + //! Topic Description to create RTPS Writer fastdds::rtps::TopicDescription reckon_topic_description_( const core::types::DdsTopic& topic) noexcept; @@ -293,7 +293,7 @@ class CommonWriter : public BaseWriter, public fastdds::rtps::WriterListener //! Writer attributes to create the internal RTPS Writer. fastdds::rtps::WriterAttributes writer_attributes_; - //! TODO + //! Topic description to create the internal RTPS Writer fastdds::rtps::TopicDescription topic_description_; //! Writer QoS to create the internal RTPS Writer. diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 877fde46..b4802431 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -412,7 +412,7 @@ fastdds::dds::Topic* CommonParticipant::topic_related_( new TopicDataType( payload_pool_, topic.type_name, - topic.type_ids, + topic.type_identifiers, topic.topic_qos.keyed)) ); } diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 7c4e0560..fec0be6c 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -41,8 +41,6 @@ namespace ddspipe { namespace participants { using namespace eprosima::ddspipe::core; -using namespace eprosima::ddspipe::core::types; -using namespace eprosima::fastdds::dds::xtypes; DynTypesParticipant::DynTypesParticipant( std::shared_ptr participant_configuration, @@ -63,11 +61,6 @@ DynTypesParticipant::~DynTypesParticipant() // Do nothing } -void DynTypesParticipant::init() -{ - CommonParticipant::init(); -} - std::shared_ptr DynTypesParticipant::create_writer( const ITopic& topic) { @@ -79,7 +72,7 @@ std::shared_ptr DynTypesParticipant::create_reader( const ITopic& topic) { // If type object topic, return the internal reader for type objects - if (is_type_object_topic(topic)) + if (core::types::is_type_object_topic(topic)) { return this->type_object_reader_; } @@ -98,7 +91,7 @@ void DynTypesParticipant::on_reader_discovery( { // Get type information const auto type_info = info.type_information.type_information; - const auto type_name = info.type_name; + const auto type_name = info.type_name.to_string(); rtps::CommonParticipant::on_reader_discovery(participant, reason, info, should_be_ignored); @@ -116,7 +109,7 @@ void DynTypesParticipant::on_writer_discovery( { // Get type information const auto type_info = info.type_information.type_information; - const auto type_name = info.type_name; + const auto type_name = info.type_name.to_string(); rtps::CommonParticipant::on_writer_discovery(participant, reason, info, should_be_ignored); @@ -126,15 +119,24 @@ void DynTypesParticipant::on_writer_discovery( void DynTypesParticipant::notify_type_discovered_( const fastdds::dds::xtypes::TypeInformation& type_info, - const fastcdr::string_255& type_name) + const std::string& type_name) { - const auto type_id = type_info.complete().typeid_with_size().type_id(); + // Check if it exists already + if (received_types_.find(type_name) != received_types_.end()) + { + return; + } + + // If not, add it to the received types set + received_types_.insert(type_name); + + const auto type_identifier = type_info.complete().typeid_with_size().type_id(); fastdds::dds::xtypes::TypeObject dyn_type_object; if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( - type_id, + type_identifier, dyn_type_object)) { - EPROSIMA_LOG_WARNING(DDSPIPE_DYNTYPES_PARTICIPANT, + EPROSIMA_LOG_INFO(DDSPIPE_DYNTYPES_PARTICIPANT, "Failed to get type object of " << type_name << " type"); return; } @@ -149,18 +151,17 @@ void DynTypesParticipant::notify_type_discovered_( return; } - // Notify type_id and its associated tyme_name. - // NOTE: We assume each type_name corresponds to only one type_id + // Notify type_identifier + // NOTE: We assume each type_name corresponds to only one type_identifier EPROSIMA_LOG_INFO(DDSPIPE_DYNTYPES_PARTICIPANT, "Participant " << this->id() << " discovered type object " << dyn_type->get_name()); - monitor_type_discovered(type_name.to_string()); + monitor_type_discovered(type_name); // Create data containing Dynamic Type - auto data = std::make_unique(); + auto data = std::make_unique(); data->dynamic_type = dyn_type; // TODO: add constructor with param - data->type_name = type_name; - data->type_id = type_id; + data->type_identifier = type_identifier; // Insert new data in internal reader queue type_object_reader_->simulate_data_reception(std::move(data)); diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index ca71f9c7..a94df95e 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -262,8 +262,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( // Warning: Logical port is not needed unless domain could change // Add as remote server and add it to builtin - params.builtin.metatrafficUnicastLocatorList.push_back(locator); - params.defaultUnicastLocatorList.push_back(locator); + params.builtin.discovery_config.m_DiscoveryServers.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Add connection address " << address << " for server " << server_prefix << diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp index b4b3876f..87449a8f 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/BaseReader.cpp @@ -122,7 +122,7 @@ utils::ReturnCode BaseReader::take( { logDevError(DDSPIPE_BASEREADER, "Attempt to take data from disabled Reader in Participant " << participant_id_); - return utils::ReturnCode::NOT_ENABLED; + return utils::ReturnCode::RETCODE_NOT_ENABLED; } } diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp index 8f8b9f74..5f74af42 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/BlankReader.cpp @@ -41,7 +41,7 @@ void BlankReader::unset_on_data_available_callback() noexcept utils::ReturnCode BlankReader::take( std::unique_ptr& /* data */) noexcept { - return utils::ReturnCode::NO_DATA; + return utils::ReturnCode::RETCODE_NO_DATA; } core::types::Guid BlankReader::guid() const diff --git a/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp b/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp index 126bff98..8b628455 100644 --- a/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp +++ b/ddspipe_participants/src/cpp/reader/auxiliar/InternalReader.cpp @@ -72,14 +72,14 @@ utils::ReturnCode InternalReader::take_nts_( // There is no data pending sent if (data_to_send_.empty()) { - return utils::ReturnCode::NO_DATA; + return utils::ReturnCode::RETCODE_NO_DATA; } // Move first data in queue to input data = std::move(data_to_send_.front()); data_to_send_.pop(); - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp index 233eef7c..943cb2e8 100644 --- a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp @@ -169,7 +169,7 @@ utils::ReturnCode CommonReader::take_nts_( // Check if there is data available if (!(reader_->get_unread_count() > 0)) { - return utils::ReturnCode::NO_DATA; + return utils::ReturnCode::RETCODE_NO_DATA; } std::unique_ptr rtps_data; @@ -197,7 +197,7 @@ utils::ReturnCode CommonReader::take_nts_( if (!rtps_data) { EPROSIMA_LOG_ERROR(DDSPIPE_DDS_READER, "The data taken by the reader is not valid."); - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } fill_received_data_(info, *rtps_data); @@ -205,7 +205,7 @@ utils::ReturnCode CommonReader::take_nts_( // data is a unique_ptr; the memory will be handled correctly. data.reset(rtps_data.release()); - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } void CommonReader::enable_nts_() noexcept diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 121f5c65..73bb7fbb 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -164,7 +164,7 @@ utils::ReturnCode CommonReader::take_nts_( // Check if there is data available if (!(rtps_reader_->get_unread_count() > 0)) { - return utils::ReturnCode::NO_DATA; + return utils::ReturnCode::RETCODE_NO_DATA; } // Read first change of the history @@ -172,12 +172,12 @@ utils::ReturnCode CommonReader::take_nts_( if (!received_change) { // Error reading. - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } // If data received is not correct, discard it and remove it from history auto ret = is_data_correct_(received_change); - if (ret != utils::ReturnCode::OK) + if (ret != utils::ReturnCode::RETCODE_OK) { // Remove the change in the History and release it in the reader rtps_reader_->get_history()->remove_change(received_change); @@ -192,7 +192,7 @@ utils::ReturnCode CommonReader::take_nts_( // Remove the change in the History and release it in the reader rtps_reader_->get_history()->remove_change(received_change); - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } RtpsPayloadData* CommonReader::create_data_( @@ -331,13 +331,13 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( topic_description.topic_name = topic.m_topic_name; topic_description.type_name = topic.type_name; - fastdds::dds::xtypes::TypeIdentifierPair type_ids_pair; - type_ids_pair.type_identifier1(topic.type_ids.type_identifier1()); + fastdds::dds::xtypes::TypeIdentifierPair type_identifiers; + type_identifiers.type_identifier1(topic.type_identifiers.type_identifier1()); // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - type_ids_pair, + type_identifiers, type_information)) { topic_description.type_information = type_information; @@ -511,7 +511,7 @@ utils::ReturnCode CommonReader::is_data_correct_( EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data without correct writer GUID."); - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } // Check that the data is consistent @@ -523,11 +523,11 @@ utils::ReturnCode CommonReader::is_data_correct_( EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Error taking data with length " << received_change->serializedPayload.length << "."); - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } } /* namespace rtps */ diff --git a/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp b/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp index 660f9ad9..6340c685 100644 --- a/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp +++ b/ddspipe_participants/src/cpp/testing/entities/mock_entities.cpp @@ -143,13 +143,13 @@ utils::ReturnCode MockReader::take_nts_( if (data_queue_.empty()) { - return utils::ReturnCode::NO_DATA; + return utils::ReturnCode::RETCODE_NO_DATA; } data.reset(new MockRoutingData(std::move(data_queue_.front()))); data_queue_.pop(); - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } void MockReader::enable_nts_() noexcept @@ -181,7 +181,7 @@ utils::ReturnCode MockWriter::write_nts_( } ++waiter_; - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } MockRoutingData MockWriter::wait_data() diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index 94b36807..fe353dc6 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -31,7 +31,7 @@ using eprosima::ddspipe::core::types::operator <<; TopicDataType::TopicDataType( const std::shared_ptr& payload_pool, const std::string& type_name, - const fastdds::dds::xtypes::TypeIdentifierPair& type_ids, + const fastdds::dds::xtypes::TypeIdentifierPair& type_identifiers, const bool keyed) : payload_pool_(payload_pool) , type_name_(type_name) @@ -45,7 +45,7 @@ TopicDataType::TopicDataType( set_name(type_name_.c_str()); // Set Type Identifiers - type_identifiers_ = type_ids; + type_identifiers_ = type_identifiers; } TopicDataType::~TopicDataType() diff --git a/ddspipe_participants/src/cpp/utils/utils.cpp b/ddspipe_participants/src/cpp/utils/utils.cpp index 7af2a933..7c26d4f2 100644 --- a/ddspipe_participants/src/cpp/utils/utils.cpp +++ b/ddspipe_participants/src/cpp/utils/utils.cpp @@ -75,8 +75,8 @@ core::types::Endpoint create_common_endpoint_from_info_( endpoint.topic.topic_qos.keyed.set_value(is_keyed_(info.guid)); // Set TypeIdentifier - endpoint.topic.type_ids.type_identifier1(info.type_information.type_information.complete().typeid_with_size().type_id()); - endpoint.topic.type_ids.type_identifier2(info.type_information.type_information.minimal().typeid_with_size().type_id()); + endpoint.topic.type_identifiers.type_identifier1(info.type_information.type_information.complete().typeid_with_size().type_id()); + endpoint.topic.type_identifiers.type_identifier2(info.type_information.type_information.minimal().typeid_with_size().type_id()); // Parse Topic core::types::DdsTopic info_topic; diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp index a76d1e48..decbc911 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/BaseWriter.cpp @@ -77,12 +77,12 @@ utils::ReturnCode BaseWriter::write( { logDevError(DDSPIPE_BASEWRITER, "Attempt to write data from disabled Writer in topic in Participant " << participant_id_); - return utils::ReturnCode::NOT_ENABLED; + return utils::ReturnCode::RETCODE_NOT_ENABLED; } if (!should_send_sample_()) { - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } return write_nts_(data); diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp index 9ae12217..e9e11a44 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/BlankWriter.cpp @@ -30,7 +30,7 @@ void BlankWriter::disable() noexcept utils::ReturnCode BlankWriter::write( core::IRoutingData& /* data */) noexcept { - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp b/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp index a60edb63..64389393 100644 --- a/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/auxiliar/RtpsEchoWriter.cpp @@ -63,7 +63,7 @@ utils::ReturnCode RtpsEchoWriter::write( "."); } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index 403d4682..5bc41890 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -116,14 +116,7 @@ utils::ReturnCode CommonWriter::write_nts_( } else { - if (payload_pool_->write(writer_, &rtps_data)) - { - return utils::ReturnCode::OK; - } - else - { - return utils::ReturnCode::ERROR; - } + return payload_pool_->write(writer_, &rtps_data); } } diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp index ff19f8cf..a678610d 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/SchemaWriter.cpp @@ -65,10 +65,10 @@ utils::ReturnCode SchemaWriter::write_nts_( EPROSIMA_LOG_WARNING( DDSPIPE_SCHEMA_WRITER, "Error writting data in topic " << topic_ << " : <" << e.what() << ">."); - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp index af825bdd..2bb48d86 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp @@ -52,7 +52,7 @@ utils::ReturnCode TypeObjectWriter::write_nts_( try { schema_handler_->add_schema( - dynamic_type_data.dynamic_type, dynamic_type_data.type_name.to_string(), dynamic_type_data.type_id); + dynamic_type_data.dynamic_type, dynamic_type_data.type_identifier); } catch (const utils::Exception& e) { @@ -60,10 +60,10 @@ utils::ReturnCode TypeObjectWriter::write_nts_( DDSPIPE_TYPEOBJECT_WRITER, "Error generating schema for type " << dynamic_type_data.dynamic_type->get_name() << " : <" << e.what() << ">."); - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } } /* namespace participants */ diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index 7ed957c0..43df6eb4 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -66,7 +66,7 @@ utils::ReturnCode SimpleWriter::fill_to_send_data_( to_send_params.related_sample_identity(rpc_data.write_params.get_reference().related_sample_identity()); } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } void SimpleWriter::fill_sent_data_( diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 21ac9bb4..6751de96 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -185,7 +185,7 @@ utils::ReturnCode CommonWriter::write_nts_( // If still is not able to get a change, return an error code if (!new_change) { - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } logDebug(DDSPIPE_RTPS_COMMONWRITER, @@ -197,7 +197,7 @@ utils::ReturnCode CommonWriter::write_nts_( // Fill cache change with specific data to send auto ret = fill_to_send_data_(new_change, write_params, rtps_data); - if (ret != utils::ReturnCode::OK) + if (ret != utils::ReturnCode::RETCODE_OK) { EPROSIMA_LOG_ERROR(DDSPIPE_RTPS_COMMONWRITER, "Error setting change to send."); return ret; @@ -211,7 +211,7 @@ utils::ReturnCode CommonWriter::write_nts_( // At this point, write params is now the output of adding change fill_sent_data_(write_params, rtps_data); - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } utils::ReturnCode CommonWriter::fill_to_send_data_( @@ -241,7 +241,7 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( to_send_change_to_fill->serializedPayload)) { logDevError(DDSPIPE_RTPS_COMMONWRITER, "Error getting Payload."); - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } } @@ -251,7 +251,7 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( // Set source time stamp to be the original one to_send_params.source_timestamp(data.source_timestamp); - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } void CommonWriter::fill_sent_data_( @@ -393,7 +393,7 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - topic.type_ids, + topic.type_identifiers, type_information)) { topic_description.type_information = type_information; diff --git a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp index e51b8453..18e52d15 100644 --- a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp +++ b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp @@ -32,7 +32,7 @@ utils::ReturnCode XmlHandler::load_xml( if (ret != fastdds::dds::RETCODE_OK) { - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } // Load string if exist @@ -44,7 +44,7 @@ utils::ReturnCode XmlHandler::load_xml( if (ret != fastdds::dds::RETCODE_OK) { - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } } @@ -55,11 +55,11 @@ utils::ReturnCode XmlHandler::load_xml( if (ret != fastdds::dds::RETCODE_OK) { - return utils::ReturnCode::ERROR; + return utils::ReturnCode::RETCODE_ERROR; } } - return utils::ReturnCode::OK; + return utils::ReturnCode::RETCODE_OK; } } /* namespace participants */ diff --git a/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp b/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp index af69c6ec..bafd666d 100644 --- a/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp +++ b/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp @@ -143,7 +143,6 @@ constexpr const char* TIMESTAMP_NANOSECONDS_TAG("nanoseconds"); //! TODO: add co constexpr const char* DDS_PUBLISHING_ENABLE_TAG("enable"); //! Whether the publishing is enabled constexpr const char* DDS_PUBLISHING_DOMAIN_TAG("domain"); //! The DDS domain id to publish in constexpr const char* DDS_PUBLISHING_TOPIC_NAME_TAG("topic-name"); //! The DDS topic name to publish in -constexpr const char* DDS_PUBLISHING_PUBLISH_TYPE_TAG("publish-type"); //! Whether the LogEntry type should be published // Custom routes related tags constexpr const char* ROUTES_TAG("routes"); //! Forwarding routes diff --git a/ddspipe_yaml/src/cpp/YamlReader_types.cpp b/ddspipe_yaml/src/cpp/YamlReader_types.cpp index 8d1868dd..7d397e2f 100644 --- a/ddspipe_yaml/src/cpp/YamlReader_types.cpp +++ b/ddspipe_yaml/src/cpp/YamlReader_types.cpp @@ -362,12 +362,6 @@ void YamlReader::fill( { object.topic_name = get(yml, DDS_PUBLISHING_TOPIC_NAME_TAG, version); } - - // Optional publish type - if (is_tag_present(yml, DDS_PUBLISHING_PUBLISH_TYPE_TAG)) - { - object.publish_type = get(yml, DDS_PUBLISHING_PUBLISH_TYPE_TAG, version); - } } template <> From 6be6daf32a15f24f9b6072b471f828a3cc6d7cde Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 13 Aug 2024 10:16:16 +0200 Subject: [PATCH 23/53] Remove GuidPrefix attribute from DiscoveryServerConnectionAddress Signed-off-by: Lucia Echevarria --- .../DiscoveryServerConnectionAddress.hpp | 14 +-------- .../rtps/DiscoveryServerParticipant.cpp | 16 ++++------ .../src/cpp/testing/random_values.cpp | 1 - .../DiscoveryServerConnectionAddress.cpp | 30 +++---------------- ddspipe_yaml/src/cpp/YamlReader_types.cpp | 10 ++----- ...coveryServerAddressTest_get_ds_address.ipp | 16 ---------- 6 files changed, 12 insertions(+), 75 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp b/ddspipe_participants/include/ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp index b497ef04..0391acf0 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp @@ -19,7 +19,6 @@ #include #include -#include namespace eprosima { namespace ddspipe { @@ -30,8 +29,7 @@ namespace types { * @brief Collection of Addresses to connect with a remote Disovery Server. * * An address will remain in an IP and a Port, IP version and Transport Protocol. - * This class has several address associated with one \c GuidPrefix in order to connect with - * a remote Discovery Server. + * This class has several address in order to connect with a remote Discovery Server. */ class DiscoveryServerConnectionAddress { @@ -40,18 +38,12 @@ class DiscoveryServerConnectionAddress /** * @brief Construct a new \c DiscoveryServerConnectionAddress object with all the parameters * - * @param discovery_server_guid_ : Guid Prefix of the remote Discovery Server * @param addresses_ collection of addresses */ DDSPIPE_PARTICIPANTS_DllAPI DiscoveryServerConnectionAddress( - core::types::GuidPrefix discovery_server_guid, std::set
addresses); - //! Discovery Server \c GuidPrefix Port getter - DDSPIPE_PARTICIPANTS_DllAPI - core::types::GuidPrefix discovery_server_guid_prefix() const noexcept; - //! Addresses getter DDSPIPE_PARTICIPANTS_DllAPI std::set
addresses() const noexcept; @@ -59,7 +51,6 @@ class DiscoveryServerConnectionAddress /** * @brief Whether the address is correct * - * Checks if GuidPrefix is correct. * Checks if it has at least one correct address. */ DDSPIPE_PARTICIPANTS_DllAPI @@ -77,9 +68,6 @@ class DiscoveryServerConnectionAddress protected: - //! Internal Discovery Server Guid Prefix object - core::types::GuidPrefix discovery_server_guid_prefix_; - //! Internal Addresses object std::set
addresses_; }; diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index a94df95e..fb289f78 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -205,24 +205,19 @@ DiscoveryServerParticipant::reckon_participant_attributes_( { // Invalid connection address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Discard connection address with remote server: " << - connection_address.discovery_server_guid_prefix() << - " in Participant " << configuration->id << " initialization."); + "Discard connection address with remote server in Participant " << + configuration->id << " initialization."); continue; } - // Set Server GUID - core::types::GuidPrefix server_prefix = connection_address.discovery_server_guid_prefix(); - for (types::Address address : connection_address.addresses()) { if (!address.is_valid()) { // Invalid ip address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Discard connection address with remote server: " << - connection_address.discovery_server_guid_prefix() << - " due to invalid ip address " << address.ip() << " in Participant " << configuration->id << + "Discard connection address with remote server due to invalid ip address " << + address.ip() << " in Participant " << configuration->id << " initialization."); continue; } @@ -265,8 +260,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( params.builtin.discovery_config.m_DiscoveryServers.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Add connection address " << address << " for server " << server_prefix << - " to Participant " << configuration->id << "."); + "Add connection address " << address << " to Server Participant " << configuration->id << "."); } } diff --git a/ddspipe_participants/src/cpp/testing/random_values.cpp b/ddspipe_participants/src/cpp/testing/random_values.cpp index 2f535513..cc4f67e8 100644 --- a/ddspipe_participants/src/cpp/testing/random_values.cpp +++ b/ddspipe_participants/src/cpp/testing/random_values.cpp @@ -42,7 +42,6 @@ DiscoveryServerConnectionAddress random_connection_address( } return DiscoveryServerConnectionAddress( - core::testing::random_guid_prefix(seed, ros), addresses ); } diff --git a/ddspipe_participants/src/cpp/types/address/DiscoveryServerConnectionAddress.cpp b/ddspipe_participants/src/cpp/types/address/DiscoveryServerConnectionAddress.cpp index d23de30c..550ea9e9 100644 --- a/ddspipe_participants/src/cpp/types/address/DiscoveryServerConnectionAddress.cpp +++ b/ddspipe_participants/src/cpp/types/address/DiscoveryServerConnectionAddress.cpp @@ -20,18 +20,11 @@ namespace participants { namespace types { DiscoveryServerConnectionAddress::DiscoveryServerConnectionAddress( - core::types::GuidPrefix discovery_server_guid, std::set
addresses) - : discovery_server_guid_prefix_(discovery_server_guid) - , addresses_(addresses) + : addresses_(addresses) { } -core::types::GuidPrefix DiscoveryServerConnectionAddress::discovery_server_guid_prefix() const noexcept -{ - return discovery_server_guid_prefix_; -} - std::set
DiscoveryServerConnectionAddress::addresses() const noexcept { return addresses_; @@ -39,11 +32,6 @@ std::set
DiscoveryServerConnectionAddress::addresses() const noexcept bool DiscoveryServerConnectionAddress::is_valid() const noexcept { - if (!discovery_server_guid_prefix_.is_valid()) - { - return false; - } - for (auto address : addresses_) { if (address.is_valid()) @@ -58,30 +46,20 @@ bool DiscoveryServerConnectionAddress::is_valid() const noexcept bool DiscoveryServerConnectionAddress::operator <( const DiscoveryServerConnectionAddress& other) const noexcept { - if (this->discovery_server_guid_prefix() == other.discovery_server_guid_prefix()) - { - // Same Guid - return this->addresses() < other.addresses(); - } - else - { - // Different guid - return this->discovery_server_guid_prefix() < other.discovery_server_guid_prefix(); - } + return this->addresses() < other.addresses(); } bool DiscoveryServerConnectionAddress::operator ==( const DiscoveryServerConnectionAddress& other) const noexcept { - return (this->discovery_server_guid_prefix() == other.discovery_server_guid_prefix()) && - (this->addresses() == other.addresses()); + return (this->addresses() == other.addresses()); } std::ostream& operator <<( std::ostream& output, const DiscoveryServerConnectionAddress& address) { - output << "{{" << address.discovery_server_guid_prefix() << "}["; + output << "{["; for (auto a : address.addresses()) { output << a << ","; diff --git a/ddspipe_yaml/src/cpp/YamlReader_types.cpp b/ddspipe_yaml/src/cpp/YamlReader_types.cpp index 7d397e2f..9c34621c 100644 --- a/ddspipe_yaml/src/cpp/YamlReader_types.cpp +++ b/ddspipe_yaml/src/cpp/YamlReader_types.cpp @@ -301,28 +301,22 @@ DiscoveryServerConnectionAddress _get_discovery_server_connection_address_v1( const Yaml& yml, const YamlReaderVersion version) { - // GuidPrefix required - GuidPrefix server_guid = YamlReader::get(yml, version); - // Addresses required std::set
addresses = YamlReader::get_set
(yml, COLLECTION_ADDRESSES_TAG, version); // Create Connection Address - return DiscoveryServerConnectionAddress(server_guid, addresses); + return DiscoveryServerConnectionAddress(addresses); } DiscoveryServerConnectionAddress _get_discovery_server_connection_address_latest( const Yaml& yml, const YamlReaderVersion version) { - // GuidPrefix required - GuidPrefix server_guid = YamlReader::get(yml, DISCOVERY_SERVER_GUID_PREFIX_TAG, version); - // Addresses required std::set
addresses = YamlReader::get_set
(yml, COLLECTION_ADDRESSES_TAG, version); // Create Connection Address - return DiscoveryServerConnectionAddress(server_guid, addresses); + return DiscoveryServerConnectionAddress(addresses); } template <> diff --git a/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address.ipp b/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address.ipp index 033cabcf..1eaec143 100644 --- a/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address.ipp +++ b/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address.ipp @@ -44,13 +44,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address) { Yaml yml_ds_address; - // Get random guid prefix and add it to yaml - core::types::GuidPrefix guid_prefix = random_guid_prefix(); - Yaml yml_guid; - guid_prefix_to_yaml(yml_guid, guid_prefix); - - yml_ds_address[DISCOVERY_SERVER_GUID_PREFIX_TAG] = yml_guid; - // Get random address and add it to yaml participants::types::Address address = random_address(); Yaml yml_addresses; @@ -70,7 +63,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address) YamlReader::get(yml, "ds-address", LATEST); // Check result - ASSERT_EQ(guid_prefix, result.discovery_server_guid_prefix()); ASSERT_EQ(result.addresses().size(), 1u); ASSERT_EQ(address, *result.addresses().begin()); } @@ -79,13 +71,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address) { Yaml yml_ds_address; - // Get random guid prefix and add it to yaml - core::types::GuidPrefix guid_prefix = random_guid_prefix(); - Yaml yml_guid; - guid_prefix_to_yaml(yml_guid, guid_prefix); - - yml_ds_address[DISCOVERY_SERVER_GUID_PREFIX_TAG] = yml_guid; - // Get random address and add it to yaml Yaml yml_addresses; std::vector addresses; @@ -111,7 +96,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address) YamlReader::get(yml, "ds-address", LATEST); // Check result - ASSERT_EQ(guid_prefix, result.discovery_server_guid_prefix()); ASSERT_EQ(result.addresses().size(), TEST_ADDRESSES_NUMBER); // Check every address introduced in yaml is in result From edb54509ffd71da30c9a7830d1c542c6380a4c41 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 13 Aug 2024 10:18:23 +0200 Subject: [PATCH 24/53] Remove is_keyed_ method after Publication/SubscriptionBuiltinTopicData update in Fast DDS Signed-off-by: Lucia Echevarria --- .../include/ddspipe_participants/utils/utils.hpp | 6 ------ ddspipe_participants/src/cpp/utils/utils.cpp | 12 +----------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp index 1cd8b3b2..01eb53be 100644 --- a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp +++ b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp @@ -28,12 +28,6 @@ namespace ddspipe { namespace participants { namespace detail { -/** - * @brief Checks if the writer/reader is keyed based on its \c GUID_t . - */ -bool is_keyed_( - const eprosima::fastdds::rtps::GUID_t& guid); - /** * @brief Common part to create any endpoint from info object */ diff --git a/ddspipe_participants/src/cpp/utils/utils.cpp b/ddspipe_participants/src/cpp/utils/utils.cpp index 7c26d4f2..2ac1f62e 100644 --- a/ddspipe_participants/src/cpp/utils/utils.cpp +++ b/ddspipe_participants/src/cpp/utils/utils.cpp @@ -28,16 +28,6 @@ namespace ddspipe { namespace participants { namespace detail { -bool is_keyed_( - const eprosima::fastdds::rtps::GUID_t& guid) -{ - const eprosima::fastdds::rtps::octet identifier = guid.entityId.value[3]; - - // - For writers: NO_KEY = 0x03, WITH_KEY = 0x02 - // - For readers: NO_KEY = 0x04, WITH_KEY = 0x07 - return (identifier & 0x0F) == 0x02 || (identifier & 0x0F) == 0x07; -} - template core::types::Endpoint create_common_endpoint_from_info_( const DiscoveryBuiltinTopicData& info, @@ -72,7 +62,7 @@ core::types::Endpoint create_common_endpoint_from_info_( // Set Topic with ownership endpoint.topic.topic_qos.ownership_qos.set_value(info.ownership.kind); // Set Topic key - endpoint.topic.topic_qos.keyed.set_value(is_keyed_(info.guid)); + endpoint.topic.topic_qos.keyed.set_value(info.topic_kind == eprosima::fastdds::rtps::TopicKind_t::WITH_KEY); // Set TypeIdentifier endpoint.topic.type_identifiers.type_identifier1(info.type_information.type_information.complete().typeid_with_size().type_id()); From 70e8001b74591f090090e5a9ec64f01af106e185 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Fri, 16 Aug 2024 12:31:41 +0200 Subject: [PATCH 25/53] Fix CacheChangePool after rebase Signed-off-by: Lucia Echevarria --- .../efficiency/cache_change/CacheChangePool.hpp | 9 +++++---- .../ddspipe_participants/reader/rtps/CommonReader.hpp | 2 +- .../src/cpp/efficiency/cache_change/CacheChangePool.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp b/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp index 860f4e1b..9e7b3f8a 100644 --- a/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp +++ b/ddspipe_participants/include/ddspipe_participants/efficiency/cache_change/CacheChangePool.hpp @@ -14,6 +14,7 @@ #pragma once +#include #include #include @@ -45,21 +46,21 @@ class CacheChangePool : public fastdds::rtps::IChangePool, public utils::Unbound utils::PoolConfiguration configuration); //! Call UnboundedPool::reserve - virtual bool reserve_cache( + bool reserve_cache( fastdds::rtps::CacheChange_t*& cache_change) override; //! Call UnboundedPool::release - virtual bool release_cache( + bool release_cache( fastdds::rtps::CacheChange_t* cache_change) override; protected: //! Override the UnboundedPool::create_element method to create a RouterCacheChange object. - virtual fastdds::rtps::CacheChange_t* new_element_() override; + fastdds::rtps::CacheChange_t* new_element_() override; //! Override the IPool::reset_element_ method to reset the CacheChange as a new object. void reset_element_( - fastrtps::rtps::CacheChange_t* change) override; + fastdds::rtps::CacheChange_t* change) override; }; } /* namespace core */ diff --git a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp index cafa3aa7..981728bb 100644 --- a/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp +++ b/ddspipe_participants/include/ddspipe_participants/reader/rtps/CommonReader.hpp @@ -120,7 +120,7 @@ class CommonReader : public BaseReader, public fastdds::rtps::ReaderListener */ DDSPIPE_PARTICIPANTS_DllAPI void on_requested_incompatible_qos( - fastrtps::rtps::RTPSReader*, + fastdds::rtps::RTPSReader*, fastdds::dds::PolicyMask qos) noexcept override; /** diff --git a/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp b/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp index 0a06a978..04791689 100644 --- a/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp +++ b/ddspipe_participants/src/cpp/efficiency/cache_change/CacheChangePool.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include #include @@ -47,13 +47,13 @@ fastdds::rtps::CacheChange_t* CacheChangePool::new_element_() } void CacheChangePool::reset_element_( - fastrtps::rtps::CacheChange_t* change) + fastdds::rtps::CacheChange_t* change) { // NOTE: This could be done by =operator but it is deleted, so it must be done field by field - change->kind = fastrtps::rtps::ALIVE; + change->kind = fastdds::rtps::ChangeKind_t::ALIVE; change->sequenceNumber.high = 0; change->sequenceNumber.low = 0; - change->writerGUID = fastrtps::rtps::c_Guid_Unknown; + change->writerGUID = fastdds::rtps::c_Guid_Unknown; change->instanceHandle.clear(); change->isRead = 0; change->sourceTimestamp.seconds(0); From bd98813673c15321ab3996f8a36518374a67255a Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Fri, 16 Aug 2024 12:46:14 +0200 Subject: [PATCH 26/53] Fix tests Signed-off-by: Lucia Echevarria --- .../cpp/types/dynamic_types/schema_msg.cpp | 4 +- .../unittest/efficiency/PayloadPoolTest.cpp | 6 ++- ...verAddressTest_get_ds_address_negative.ipp | 46 ------------------- 3 files changed, 7 insertions(+), 49 deletions(-) diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index fa9882f4..10b683f2 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -198,6 +198,9 @@ std::string type_kind_to_str( case fastdds::dds::xtypes::TK_FLOAT64: return "float64"; + case fastdds::dds::xtypes::TK_CHAR8: + return "int8"; + case fastdds::dds::xtypes::TK_STRING8: return "string"; @@ -211,7 +214,6 @@ std::string type_kind_to_str( return utils::demangle_if_ros_type((dyn_type->get_name()).to_string()); case fastdds::dds::xtypes::TK_FLOAT128: - case fastdds::dds::xtypes::TK_CHAR8: case fastdds::dds::xtypes::TK_CHAR16: case fastdds::dds::xtypes::TK_STRING16: case fastdds::dds::xtypes::TK_ENUM: diff --git a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp index dad9b66d..9eaa5612 100644 --- a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp @@ -77,8 +77,6 @@ class MockPayloadPool : public PayloadPool // Using parent methods and variables as public using PayloadPool::PayloadPool; - using PayloadPool::get_payload; - using PayloadPool::release_payload; using PayloadPool::reserve_; using PayloadPool::release_; using PayloadPool::reserve_count_; @@ -137,6 +135,8 @@ TEST(PayloadPoolTest, reserve) // This would (maybe) fail with SEG FAULT if the data has not been correctly set payload.data[0] = 16u; + + ASSERT_TRUE(pool.release_(payload)); } // large size @@ -155,6 +155,8 @@ TEST(PayloadPoolTest, reserve) // This would (maybe) fail with SEG FAULT if the data has not been correctly set payload.data[0] = 4u; payload.data[0x1000 - 1] = 5u; + + ASSERT_TRUE(pool.release_(payload)); } } diff --git a/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address_negative.ipp b/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address_negative.ipp index 4069f358..b0da4e83 100644 --- a/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address_negative.ipp +++ b/ddspipe_yaml/test/unittest/entities/address/test_units/YamlGetEntityDiscoveryServerAddressTest_get_ds_address_negative.ipp @@ -50,25 +50,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address_negative) eprosima::utils::ConfigurationException); } - // no guid prefix - { - Yaml yml_ds_address; - - // Get random address and add it to yaml - participants::types::Address address = eprosima::ddspipe::participants::testing::random_address(); - Yaml yml_addresses; - Yaml yml_address; - ddspipe::yaml::testing::address_to_yaml(yml_address, address); - yml_addresses.push_back(yml_address); - yml_ds_address[COLLECTION_ADDRESSES_TAG] = yml_addresses; - - Yaml yml; - yml["connection-address"] = yml_ds_address; - ASSERT_THROW( - YamlReader::get(yml, "connection-address", LATEST), - eprosima::utils::ConfigurationException); - } - // no addresses { Yaml yml_ds_address; @@ -86,33 +67,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address_negative) eprosima::utils::ConfigurationException); } - // error format in guid prefix - { - Yaml yml_ds_address; - - // Get random address and add it to yaml - participants::types::Address address = eprosima::ddspipe::participants::testing::random_address(); - Yaml yml_addresses; - Yaml yml_address; - ddspipe::yaml::testing::address_to_yaml(yml_address, address); - yml_addresses.push_back(yml_address); - yml_ds_address[COLLECTION_ADDRESSES_TAG] = yml_addresses; - - // Guid Prefix error format (inside a sequence) - core::types::GuidPrefix guid_prefix = eprosima::ddspipe::core::testing::random_guid_prefix(); - Yaml yml_guid; - guid_prefix_to_yaml(yml_guid, guid_prefix); - Yaml yml_guid_aux; - yml_guid_aux.push_back(yml_guid); - yml_ds_address[DISCOVERY_SERVER_GUID_PREFIX_TAG] = yml_guid_aux; - - Yaml yml; - yml["connection-address"] = yml_ds_address; - ASSERT_THROW( - YamlReader::get(yml, "connection-address", LATEST), - eprosima::utils::ConfigurationException); - } - // error format in addresses { Yaml yml_ds_address; From 9126924507dbf2560ff63814a25ba7d8cd0114c0 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 19 Aug 2024 07:51:06 +0200 Subject: [PATCH 27/53] Fix uncrustify Signed-off-by: Lucia Echevarria --- .../src/cpp/communication/dds/Track.cpp | 5 +-- .../src/cpp/dynamic/DiscoveryDatabase.cpp | 3 +- .../cpp/efficiency/payload/MapPayloadPool.cpp | 3 +- .../DdsMonitorParticipantRegistry.cpp | 6 ++-- .../producers/StatusMonitorProducer.cpp | 3 +- .../producers/TopicsMonitorProducer.cpp | 3 +- .../cpp/types/dynamic_types/schema_msg.cpp | 20 ++++++----- .../types/dynamic_types/types/all_types.hpp | 4 +-- .../cpp/participant/dds/XmlParticipant.cpp | 3 +- .../dynamic_types/DynTypesParticipant.cpp | 36 ++++++++++--------- .../participant/rtps/CommonParticipant.cpp | 6 ++-- .../src/cpp/reader/dds/CommonReader.cpp | 6 ++-- .../src/cpp/reader/rtps/CommonReader.cpp | 7 ++-- .../src/cpp/types/dds/TopicDataType.cpp | 2 +- ddspipe_participants/src/cpp/utils/utils.cpp | 6 ++-- .../src/cpp/writer/dds/CommonWriter.cpp | 3 +- .../writer/dynamic_types/TypeObjectWriter.cpp | 2 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 7 ++-- .../src/cpp/xml/XmlHandler.cpp | 2 +- 19 files changed, 75 insertions(+), 52 deletions(-) diff --git a/ddspipe_core/src/cpp/communication/dds/Track.cpp b/ddspipe_core/src/cpp/communication/dds/Track.cpp index efc891e7..1f964a03 100644 --- a/ddspipe_core/src/cpp/communication/dds/Track.cpp +++ b/ddspipe_core/src/cpp/communication/dds/Track.cpp @@ -242,8 +242,9 @@ void Track::transmit_() noexcept else if (ret != utils::ReturnCode::RETCODE_OK) { // Error reading data - EPROSIMA_LOG_WARNING(DDSPIPE_TRACK, "Error taking data in Track " << topic_->serialize() << ". Error code " << ret - << ". Skipping data and continue."); + EPROSIMA_LOG_WARNING(DDSPIPE_TRACK, + "Error taking data in Track " << topic_->serialize() << ". Error code " << ret + << ". Skipping data and continue."); continue; } diff --git a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp index 0c7bdab4..e2a463a9 100644 --- a/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp +++ b/ddspipe_core/src/cpp/dynamic/DiscoveryDatabase.cpp @@ -131,7 +131,8 @@ bool DiscoveryDatabase::add_endpoint_( } else { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY_DATABASE, "Inserting a new discovered Endpoint " << new_endpoint << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY_DATABASE, + "Inserting a new discovered Endpoint " << new_endpoint << "."); // Add it to the dictionary entities_.insert(std::pair(new_endpoint.guid, new_endpoint)); diff --git a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp index a04261b8..43c7ecb5 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/MapPayloadPool.cpp @@ -83,7 +83,8 @@ bool MapPayloadPool::get_payload( auto payload_it = reserved_payloads_.find(src_payload.data); if (payload_it == reserved_payloads_.end()) { - EPROSIMA_LOG_ERROR(DDSPIPE_PAYLOADPOOL, "Payload ownership is this pool, but it is not reserved from here."); + EPROSIMA_LOG_ERROR(DDSPIPE_PAYLOADPOOL, + "Payload ownership is this pool, but it is not reserved from here."); throw utils::InconsistencyException("Payload ownership is this pool, but it is not reserved from here."); } diff --git a/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp b/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp index 28288d2f..ddbb08d9 100644 --- a/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp +++ b/ddspipe_core/src/cpp/monitoring/consumers/DdsMonitorParticipantRegistry.cpp @@ -58,7 +58,8 @@ fastdds::dds::DomainParticipant* DdsMonitorParticipantRegistry::get_participant( // The participant already exists. Use it. participant = participants_[domain]; - EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Reusing Participant " << participant << " on domain " << domain << "."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, + "MONITOR | Reusing Participant " << participant << " on domain " << domain << "."); } else { @@ -68,7 +69,8 @@ fastdds::dds::DomainParticipant* DdsMonitorParticipantRegistry::get_participant( participant = fastdds::dds::DomainParticipantFactory::get_instance()->create_participant(domain, pqos); - EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Created Participant " << participant << " on domain " << domain << "."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, + "MONITOR | Created Participant " << participant << " on domain " << domain << "."); if (participant == nullptr) { diff --git a/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp b/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp index 732dca70..fd868d26 100644 --- a/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp +++ b/ddspipe_core/src/cpp/monitoring/producers/StatusMonitorProducer.cpp @@ -83,7 +83,8 @@ void StatusMonitorProducer::register_consumer( std::lock_guard lock(mutex_); - EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Registering consumer " << consumer->get_name() << " on StatusMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, + "MONITOR | Registering consumer " << consumer->get_name() << " on StatusMonitorProducer."); consumers_.push_back(std::move(consumer)); } diff --git a/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp b/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp index 6316a02d..b03972ef 100644 --- a/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp +++ b/ddspipe_core/src/cpp/monitoring/producers/TopicsMonitorProducer.cpp @@ -81,7 +81,8 @@ void TopicsMonitorProducer::register_consumer( std::lock_guard lock(mutex_); - EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, "MONITOR | Registering consumer " << consumer->get_name() << " on TopicsMonitorProducer."); + EPROSIMA_LOG_INFO(DDSPIPE_MONITOR, + "MONITOR | Registering consumer " << consumer->get_name() << " on TopicsMonitorProducer."); consumers_.push_back(std::move(consumer)); } diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index 10b683f2..3d4d54a9 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -68,11 +68,12 @@ std::string type_kind_to_str( fastdds::dds::DynamicType::_ref_type container_internal_type( const fastdds::dds::DynamicType::_ref_type& dyn_type) { - fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits:: + make_shared()}; if (fastdds::dds::RETCODE_OK != dyn_type->get_descriptor(type_descriptor)) { throw utils::InconsistencyException( - "Failed to get Type Descriptor for type: " + dyn_type->get_name().to_string()); + "Failed to get Type Descriptor for type: " + dyn_type->get_name().to_string()); } return type_descriptor->element_type(); @@ -81,11 +82,12 @@ fastdds::dds::DynamicType::_ref_type container_internal_type( fastdds::dds::BoundSeq array_size( const fastdds::dds::DynamicType::_ref_type& dyn_type) { - fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits::make_shared()}; + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits:: + make_shared()}; if (fastdds::dds::RETCODE_OK != dyn_type->get_descriptor(type_descriptor)) { throw utils::InconsistencyException( - "Failed to get Type Descriptor for type: " + dyn_type->get_name().to_string()); + "Failed to get Type Descriptor for type: " + dyn_type->get_name().to_string()); } return type_descriptor->bound(); @@ -100,18 +102,19 @@ std::vector> get_me if (fastdds::dds::RETCODE_OK != dyn_type->get_all_members(members)) { throw utils::InconsistencyException( - "Failed to get Type Members for type: " + dyn_type->get_name().to_string()); + "Failed to get Type Members for type: " + dyn_type->get_name().to_string()); } for (const auto& member : members) { fastdds::dds::ObjectName dyn_name = member.second->get_name(); - fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits::make_shared()}; + fastdds::dds::MemberDescriptor::_ref_type member_descriptor {fastdds::dds::traits + ::make_shared()}; if (fastdds::dds::RETCODE_OK != member.second->get_descriptor(member_descriptor)) { throw utils::InconsistencyException( - "Failed to get Type Descriptor of Member with name: " + dyn_name.to_string()); + "Failed to get Type Descriptor of Member with name: " + dyn_name.to_string()); } result.emplace_back( @@ -245,7 +248,8 @@ utils::TreeNode generate_dyn_type_tree( { // If is struct, the call is recursive. // Create new tree node - utils::TreeNode parent(member_name, utils::demangle_if_ros_type((type->get_name()).to_string()), true); + utils::TreeNode parent(member_name, utils::demangle_if_ros_type( + (type->get_name()).to_string()), true); // Get all members of this struct std::vectorget_participant_extended_qos_from_profile( + fastdds::dds::RETCODE_OK == + fastdds::dds::DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( xml_specific_configuration_.participant_profile.get_value(), extended_qos)) { diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index fec0be6c..001fed22 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -82,10 +82,10 @@ std::shared_ptr DynTypesParticipant::create_reader( } void DynTypesParticipant::on_reader_discovery( - fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::ReaderDiscoveryStatus reason, - const fastdds::rtps::SubscriptionBuiltinTopicData& info, - bool& should_be_ignored) + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, + bool& should_be_ignored) { if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { @@ -100,10 +100,10 @@ void DynTypesParticipant::on_reader_discovery( } void DynTypesParticipant::on_writer_discovery( - fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::WriterDiscoveryStatus reason, - const fastdds::rtps::PublicationBuiltinTopicData& info, - bool& should_be_ignored) + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, + bool& should_be_ignored) { if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { @@ -118,8 +118,8 @@ void DynTypesParticipant::on_writer_discovery( } void DynTypesParticipant::notify_type_discovered_( - const fastdds::dds::xtypes::TypeInformation& type_info, - const std::string& type_name) + const fastdds::dds::xtypes::TypeInformation& type_info, + const std::string& type_name) { // Check if it exists already if (received_types_.find(type_name) != received_types_.end()) @@ -132,22 +132,24 @@ void DynTypesParticipant::notify_type_discovered_( const auto type_identifier = type_info.complete().typeid_with_size().type_id(); fastdds::dds::xtypes::TypeObject dyn_type_object; - if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( - type_identifier, - dyn_type_object)) + if (fastdds::dds::RETCODE_OK != + fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( + type_identifier, + dyn_type_object)) { EPROSIMA_LOG_INFO(DDSPIPE_DYNTYPES_PARTICIPANT, - "Failed to get type object of " << type_name << " type"); + "Failed to get type object of " << type_name << " type"); return; } // Create Dynamic Type - fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( - dyn_type_object)->build(); + fastdds::dds::DynamicType::_ref_type dyn_type = + fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object( + dyn_type_object)->build(); if (!dyn_type) { EPROSIMA_LOG_WARNING(DDSPIPE_DYNTYPES_PARTICIPANT, - "Failed to create Dynamic Type " << type_name); + "Failed to create Dynamic Type " << type_name); return; } diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 6906c367..914cdf9d 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -120,7 +120,8 @@ void CommonParticipant::on_reader_discovery( { if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { - core::types::Endpoint info_reader = detail::create_endpoint_from_info_( + core::types::Endpoint info_reader = + detail::create_endpoint_from_info_( info, this->id()); if (reason == fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER) @@ -160,7 +161,8 @@ void CommonParticipant::on_writer_discovery( { if (info.guid.guidPrefix != participant->getGuid().guidPrefix) { - core::types::Endpoint info_writer = detail::create_endpoint_from_info_( + core::types::Endpoint info_writer = + detail::create_endpoint_from_info_( info, this->id()); if (reason == fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER) diff --git a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp index 943cb2e8..da1dd7ed 100644 --- a/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp @@ -54,7 +54,8 @@ CommonReader::~CommonReader() void CommonReader::init() { - EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "Initializing reader in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, + "Initializing reader in " << participant_id_ << " for topic " << topic_ << "."); // Create subscriber dds_subscriber_ = dds_participant_->create_subscriber( @@ -94,7 +95,8 @@ void CommonReader::init() void CommonReader::on_data_available( fastdds::dds::DataReader* /* reader */) { - EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "On data available in reader in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, + "On data available in reader in " << participant_id_ << " for topic " << topic_ << "."); // The CommonReader notifies the reception of a message to the Monitor when a on_data_available event is received. // An on_data_available event can be received with more than one message, but figuring out the number of messages diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 73bb7fbb..6ae393a1 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -336,9 +336,10 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; - if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - type_identifiers, - type_information)) + if (fastdds::dds::RETCODE_OK == + fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( + type_identifiers, + type_information)) { topic_description.type_information = type_information; } diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index fe353dc6..5cf5d73c 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -81,7 +81,7 @@ bool TopicDataType::serialize( } bool TopicDataType::deserialize( - fastdds::rtps::SerializedPayload_t& src_payload, + fastdds::rtps::SerializedPayload_t& src_payload, void* data) { logDebug(DDSPIPE_DDS_TYPESUPPORT, "Deserializing data " << src_payload << "."); diff --git a/ddspipe_participants/src/cpp/utils/utils.cpp b/ddspipe_participants/src/cpp/utils/utils.cpp index 2ac1f62e..9bbd5071 100644 --- a/ddspipe_participants/src/cpp/utils/utils.cpp +++ b/ddspipe_participants/src/cpp/utils/utils.cpp @@ -65,8 +65,10 @@ core::types::Endpoint create_common_endpoint_from_info_( endpoint.topic.topic_qos.keyed.set_value(info.topic_kind == eprosima::fastdds::rtps::TopicKind_t::WITH_KEY); // Set TypeIdentifier - endpoint.topic.type_identifiers.type_identifier1(info.type_information.type_information.complete().typeid_with_size().type_id()); - endpoint.topic.type_identifiers.type_identifier2(info.type_information.type_information.minimal().typeid_with_size().type_id()); + endpoint.topic.type_identifiers.type_identifier1( + info.type_information.type_information.complete().typeid_with_size().type_id()); + endpoint.topic.type_identifiers.type_identifier2( + info.type_information.type_information.minimal().typeid_with_size().type_id()); // Parse Topic core::types::DdsTopic info_topic; diff --git a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp index 5bc41890..0ed6bba9 100644 --- a/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dds/CommonWriter.cpp @@ -55,7 +55,8 @@ CommonWriter::~CommonWriter() void CommonWriter::init() { - EPROSIMA_LOG_INFO(DDSPIPE_DDS_WRITER, "Initializing writer in " << participant_id_ << " for topic " << topic_ << "."); + EPROSIMA_LOG_INFO(DDSPIPE_DDS_WRITER, + "Initializing writer in " << participant_id_ << " for topic " << topic_ << "."); // Create publisher dds_publisher_ = dds_participant_->create_publisher( diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp index 2bb48d86..e5777a52 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp @@ -52,7 +52,7 @@ utils::ReturnCode TypeObjectWriter::write_nts_( try { schema_handler_->add_schema( - dynamic_type_data.dynamic_type, dynamic_type_data.type_identifier); + dynamic_type_data.dynamic_type, dynamic_type_data.type_identifier); } catch (const utils::Exception& e) { diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 6751de96..82f351e1 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -392,9 +392,10 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; - if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - topic.type_identifiers, - type_information)) + if (fastdds::dds::RETCODE_OK == + fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( + topic.type_identifiers, + type_information)) { topic_description.type_information = type_information; } diff --git a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp index 18e52d15..b952a30a 100644 --- a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp +++ b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp @@ -38,7 +38,7 @@ utils::ReturnCode XmlHandler::load_xml( // Load string if exist if (configuration.raw.is_set()) { - ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_string( + ret = fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_string( configuration.raw->c_str(), configuration.raw->size()); From d0a5ad2b47f64c086868dfdc261306e5ba20205f Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 19 Aug 2024 10:43:26 +0200 Subject: [PATCH 28/53] Free allocated memory in PayloadPool::release_ Signed-off-by: Lucia Echevarria --- ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index 2e570b54..3d71336d 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -104,6 +104,8 @@ bool PayloadPool::release_( { logDebug(DDSPIPE_PAYLOADPOOL, "Releasing payload ptr: " << payload.data << "."); + free(payload.data); + // Remove payload internal values payload.length = 0; payload.max_size = 0; From becfdea5db6fd06babcd2d3eebc17d07898a4e51 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 2 Sep 2024 10:46:32 +0200 Subject: [PATCH 29/53] Fill TypeInformation in Topic Description just from complete TypeIdentifier in CommonWriter (already done in CommonReader) Signed-off-by: Lucia Echevarria --- ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index 82f351e1..cb477642 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -390,11 +390,14 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( topic_description.type_name = topic.type_name; topic_description.topic_name = topic.m_topic_name; + fastdds::dds::xtypes::TypeIdentifierPair type_identifiers; + type_identifiers.type_identifier1(topic.type_identifiers.type_identifier1()); + // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; if (fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - topic.type_identifiers, + type_identifiers, type_information)) { topic_description.type_information = type_information; From 9b2873d6d408358a25b4c446a862d840c3c8015c Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 3 Sep 2024 08:10:20 +0200 Subject: [PATCH 30/53] Apply suggested changes Signed-off-by: Lucia Echevarria --- .../efficiency/payload/PayloadPool.hpp | 2 - .../producers/StatusMonitorProducer.hpp | 3 +- .../types/dynamic_types/types.hpp | 3 +- .../cpp/efficiency/payload/PayloadPool.cpp | 14 +++--- .../cpp/types/dynamic_types/schema_msg.cpp | 14 ++++-- .../efficiency/MapPayloadPoolTest.cpp | 46 ++++++++++++------- .../participant/dds/CommonParticipant.hpp | 7 ++- .../participant/dds/XmlParticipant.hpp | 2 +- .../dynamic_types/DynTypesParticipant.hpp | 3 -- .../testing/random_values.hpp | 3 +- .../ddspipe_participants/utils/utils.hpp | 8 ---- .../cpp/participant/dds/CommonParticipant.cpp | 23 +++++++++- .../cpp/participant/dds/XmlParticipant.cpp | 8 ++-- .../dynamic_types/DynTypesParticipant.cpp | 13 ++---- .../src/cpp/reader/rtps/CommonReader.cpp | 39 +++++++++++++--- .../src/cpp/testing/random_values.cpp | 3 +- .../src/cpp/writer/rtps/CommonWriter.cpp | 39 +++++++++++++--- .../src/cpp/xml/XmlHandler.cpp | 5 +- 18 files changed, 153 insertions(+), 82 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp index b6565343..a5c3fe1d 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPool.hpp @@ -16,8 +16,6 @@ #include -#include -#include #include #include diff --git a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp index fd419de3..869ec33a 100644 --- a/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp +++ b/ddspipe_core/include/ddspipe_core/monitoring/producers/StatusMonitorProducer.hpp @@ -17,14 +17,13 @@ #include #include #include +#include #include #include #include #include #include -#include -#include // DDSPIPE MONITOR MACROS diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp index 1446037b..260693f6 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp @@ -14,8 +14,6 @@ #pragma once -#include - #include #include @@ -40,6 +38,7 @@ struct DynamicTypeData : public core::IRoutingData fastdds::dds::DynamicType::_ref_type dynamic_type{nullptr}; + // Complete TypeIdentifier of the DynamicType fastdds::dds::xtypes::TypeIdentifier type_identifier{}; }; diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index 3d71336d..fc850fbb 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -104,7 +104,12 @@ bool PayloadPool::release_( { logDebug(DDSPIPE_PAYLOADPOOL, "Releasing payload ptr: " << payload.data << "."); - free(payload.data); + payload.empty(); + + if (payload.data != nullptr) + { + return false; + } // Remove payload internal values payload.length = 0; @@ -113,13 +118,6 @@ bool PayloadPool::release_( payload.payload_owner = nullptr; payload.pos = 0; - payload.empty(); - - if (payload.data != nullptr) - { - return false; - } - add_release_payload_(); return true; diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index 3d4d54a9..1abb5f3e 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -16,8 +16,9 @@ * @file schema_msg.cpp */ -#include +#include #include +#include #include #include @@ -25,7 +26,7 @@ #include #include #include -#include //To include xtypes constants +#include #include #include @@ -132,8 +133,11 @@ std::string container_kind_to_str( auto internal_type = container_internal_type(dyn_type); auto this_array_size = array_size(dyn_type); - // TODO: Change assert -> RETCODE - assert(this_array_size.size() == 1); // Multidimensional arrays not supported in ROS2 + // TODO: Change exception -> RETCODE + if (this_array_size.size() != 1) + { + throw utils::InconsistencyException("Failed to convert container type: Multidimensional arrays are not supported in ROS2."); + } std::stringstream ss; ss << type_kind_to_str(internal_type); @@ -169,7 +173,7 @@ std::string type_kind_to_str( return "bool"; case fastdds::dds::xtypes::TK_BYTE: - return "uint8"; + return "byte"; case fastdds::dds::xtypes::TK_INT8: return "int8"; diff --git a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp index 3ca5a897..ecef079a 100644 --- a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp @@ -51,15 +51,15 @@ class MockMapPayloadPool : public MapPayloadPool } uint64_t reference_count( - const types::Payload& payload) + const Payload& payload) { return reserved_payloads_[payload.data]; } void clean_all( - std::vector& payloads) + std::vector& payloads) { - for (types::Payload& payload : payloads) + for (Payload& payload : payloads) { release_payload(payload); } @@ -88,7 +88,7 @@ TEST(MapPayloadPoolTest, get_payload) // Get N different pointers { test::MockMapPayloadPool pool; - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); for (unsigned int i = 0; i < TEST_NUMBER; i++) { @@ -101,14 +101,22 @@ TEST(MapPayloadPoolTest, get_payload) // END : Clean all remaining payloads pool.clean_all(payloads); + + // Check payload pool is empty + ASSERT_TRUE(pool.is_clean()); + ASSERT_EQ(pool.pointers_stored(), 0u); } // fail reserve memory { test::MockMapPayloadPool pool; - eprosima::ddspipe::core::types::Payload payload; + Payload payload; ASSERT_FALSE(pool.get_payload(0, payload)); + + // Check payload pool is empty + ASSERT_TRUE(pool.is_clean()); + ASSERT_EQ(pool.pointers_stored(), 0u); } } @@ -130,12 +138,12 @@ TEST(MapPayloadPoolTest, get_payload_from_src) eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); test::MockMapPayloadPool* pool_ = static_cast(pool); - eprosima::ddspipe::core::types::Payload payload0; - eprosima::ddspipe::core::types::Payload payload1; - eprosima::ddspipe::core::types::Payload payload2; - eprosima::ddspipe::core::types::Payload payload3; - eprosima::ddspipe::core::types::Payload payload4; - eprosima::ddspipe::core::types::Payload payload5; + Payload payload0; + Payload payload1; + Payload payload2; + Payload payload3; + Payload payload4; + Payload payload5; // get payload0 ASSERT_TRUE(pool_->get_payload(DEFAULT_SIZE, payload0)); @@ -214,8 +222,8 @@ TEST(MapPayloadPoolTest, get_payload_from_src_no_owner) eprosima::fastdds::rtps::IPayloadPool* pool_aux = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_aux_ = static_cast(pool_aux); - eprosima::ddspipe::core::types::Payload payload_src; - eprosima::ddspipe::core::types::Payload payload_target; + Payload payload_src; + Payload payload_target; // get payload aux from pool aux pool_aux_->get_payload(DEFAULT_SIZE, payload_src); @@ -253,14 +261,18 @@ TEST(MapPayloadPoolTest, get_payload_from_src_negative) test::MockMapPayloadPool* pool_ = static_cast(pool); eprosima::fastdds::rtps::IPayloadPool* pool_aux = nullptr; // nullptr - eprosima::ddspipe::core::types::Payload payload_src; - eprosima::ddspipe::core::types::Payload payload_target; + Payload payload_src; + Payload payload_target; ASSERT_FALSE( pool_->get_payload( payload_src, payload_target)); + // Check payload pool is empty + ASSERT_TRUE(pool_->is_clean()); + ASSERT_EQ(pool_->pointers_stored(), 0u); + delete pool; } } @@ -279,7 +291,7 @@ TEST(MapPayloadPoolTest, release_payload) { eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - std::vector payloads(TEST_NUMBER); + std::vector payloads(TEST_NUMBER); // get first payload pool_->get_payload(DEFAULT_SIZE, payloads[0]); @@ -332,7 +344,7 @@ TEST(MapPayloadPoolTest, release_payload_negative) test::MockMapPayloadPool pool; test::MockMapPayloadPool pool_aux; - eprosima::ddspipe::core::types::Payload payload; + Payload payload; pool_aux.get_payload(DEFAULT_SIZE, payload); diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index 112b3083..d8c38733 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -148,12 +148,17 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain virtual fastdds::dds::DomainParticipantQos - reckon_participant_qos_() const; + reckon_participant_qos_(); virtual fastdds::dds::DomainParticipant* create_dds_participant_(); + virtual + fastdds::dds::DomainParticipantQos + add_qos_properties_( + fastdds::dds::DomainParticipantQos& qos); + ///////////////////////// // INTERNAL METHODS ///////////////////////// diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp index 3c687cac..f2a6845c 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp @@ -62,7 +62,7 @@ class XmlParticipant virtual fastdds::dds::DomainParticipantQos - reckon_participant_qos_() const override; + reckon_participant_qos_() override; ///////////////////////// // INTERNAL VARIABLES diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp index a53f4633..0ddfda67 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp @@ -56,9 +56,6 @@ class DynTypesParticipant : public rtps::SimpleParticipant std::shared_ptr payload_pool, std::shared_ptr discovery_database); - DDSPIPE_PARTICIPANTS_DllAPI - ~DynTypesParticipant(); - /** * @brief Create a writer object * diff --git a/ddspipe_participants/include/ddspipe_participants/testing/random_values.hpp b/ddspipe_participants/include/ddspipe_participants/testing/random_values.hpp index a1c0487f..ff32ffdd 100644 --- a/ddspipe_participants/include/ddspipe_participants/testing/random_values.hpp +++ b/ddspipe_participants/include/ddspipe_participants/testing/random_values.hpp @@ -30,8 +30,7 @@ types::Address random_address( DDSPIPE_PARTICIPANTS_DllAPI types::DiscoveryServerConnectionAddress random_connection_address( unsigned int seed = 0, - unsigned int size = 1, - bool ros = false); + unsigned int size = 1); } /* namespace testing */ } /* namespace participants */ diff --git a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp index 01eb53be..1df31b23 100644 --- a/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp +++ b/ddspipe_participants/include/ddspipe_participants/utils/utils.hpp @@ -28,14 +28,6 @@ namespace ddspipe { namespace participants { namespace detail { -/** - * @brief Common part to create any endpoint from info object - */ -template -core::types::Endpoint create_common_endpoint_from_info_( - const DiscoveryBuiltinTopicData& info, - const core::types::ParticipantId participant_discoverer_id); - /** * @brief Create an endpoint from info object * diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index b4802431..54f1b25b 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -352,7 +352,7 @@ CommonParticipant::CommonParticipant( // Do nothing } -fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_() const +fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_() { auto qos = fastdds::dds::DomainParticipantFactory::get_instance()->get_default_participant_qos(); @@ -387,6 +387,27 @@ fastdds::dds::DomainParticipant* CommonParticipant::create_dds_participant_() mask); } +fastdds::dds::DomainParticipantQos CommonParticipant::add_qos_properties_( + fastdds::dds::DomainParticipantQos& qos) +{ + // Enforce ignore local endpoints on XML participants + qos.properties().properties().emplace_back( + "fastdds.ignore_local_endpoints", + "true"); + + // Set app properties + qos.properties().properties().emplace_back( + "fastdds.application.id", + configuration_->app_id, + "true"); + qos.properties().properties().emplace_back( + "fastdds.application.metadata", + configuration_->app_metadata, + "true"); + + return qos; +} + fastdds::dds::Topic* CommonParticipant::topic_related_( const core::types::DdsTopic& topic) { diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index 90e2a46b..757ace43 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -84,7 +84,7 @@ std::shared_ptr XmlParticipant::create_reader( } } -fastdds::dds::DomainParticipantQos XmlParticipant::reckon_participant_qos_() const +fastdds::dds::DomainParticipantQos XmlParticipant::reckon_participant_qos_() { fastdds::dds::DomainParticipantQos qos = CommonParticipant::reckon_participant_qos_(); @@ -104,10 +104,8 @@ fastdds::dds::DomainParticipantQos XmlParticipant::reckon_participant_qos_() con } } - // Enforce ignore local endpoints on XML participants - qos.properties().properties().emplace_back( - "fastdds.ignore_local_endpoints", - "true"); + // Set qos properties + add_qos_properties_(qos); return qos; } diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 001fed22..29cffa8f 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -56,11 +56,6 @@ DynTypesParticipant::DynTypesParticipant( // Do nothing } -DynTypesParticipant::~DynTypesParticipant() -{ - // Do nothing -} - std::shared_ptr DynTypesParticipant::create_writer( const ITopic& topic) { @@ -124,12 +119,11 @@ void DynTypesParticipant::notify_type_discovered_( // Check if it exists already if (received_types_.find(type_name) != received_types_.end()) { + EPROSIMA_LOG_INFO(DDSPIPE_DYNTYPES_PARTICIPANT, + "Type " << type_name << " was already received"); return; } - // If not, add it to the received types set - received_types_.insert(type_name); - const auto type_identifier = type_info.complete().typeid_with_size().type_id(); fastdds::dds::xtypes::TypeObject dyn_type_object; if (fastdds::dds::RETCODE_OK != @@ -160,6 +154,9 @@ void DynTypesParticipant::notify_type_discovered_( monitor_type_discovered(type_name); + // If not, add it to the received types set + received_types_.insert(type_name); + // Create data containing Dynamic Type auto data = std::make_unique(); data->dynamic_type = dyn_type; // TODO: add constructor with param diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 6ae393a1..9c3665a9 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -331,19 +331,46 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( topic_description.topic_name = topic.m_topic_name; topic_description.type_name = topic.type_name; - fastdds::dds::xtypes::TypeIdentifierPair type_identifiers; - type_identifiers.type_identifier1(topic.type_identifiers.type_identifier1()); + // Check TypeIdentifierPair in DdsTopic is not empty + fastdds::dds::xtypes::TypeIdentifierPair empty_type_identifiers; + if (topic.type_identifiers == empty_type_identifiers) + { + return topic_description; + } // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; - if (fastdds::dds::RETCODE_OK == + + auto try_get_type_information = [&](const fastdds::dds::xtypes::TypeIdentifierPair& identifiers) -> bool { + return fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - type_identifiers, - type_information)) + identifiers, type_information); + }; + + if (!try_get_type_information(topic.type_identifiers)) { - topic_description.type_information = type_information; + // If get_type_information fails with TypeIdentifierPair try just with complete + fastdds::dds::xtypes::TypeIdentifierPair complete_only; + complete_only.type_identifier1(topic.type_identifiers.type_identifier1()); + + if (!try_get_type_information(complete_only)) + { + // If get_type_information fails with complete TypeIdentifier try just with minimal + fastdds::dds::xtypes::TypeIdentifierPair minimal_only; + minimal_only.type_identifier2(topic.type_identifiers.type_identifier2()); + + if (!try_get_type_information(minimal_only)) + { + logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + "Failed to get TypeInformation for type " << topic.type_name); + + return topic_description; + } + } } + topic_description.type_information = type_information; + return topic_description; } diff --git a/ddspipe_participants/src/cpp/testing/random_values.cpp b/ddspipe_participants/src/cpp/testing/random_values.cpp index cc4f67e8..12e4f8c0 100644 --- a/ddspipe_participants/src/cpp/testing/random_values.cpp +++ b/ddspipe_participants/src/cpp/testing/random_values.cpp @@ -31,8 +31,7 @@ Address random_address( DiscoveryServerConnectionAddress random_connection_address( unsigned int seed /* = 0 */, - unsigned int size /* = 1 */, - bool ros /* = false */) + unsigned int size /* = 1 */) { std::set
addresses; for (unsigned int i = 0; i < size; ++i) diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index cb477642..f06e313d 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -390,19 +390,46 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( topic_description.type_name = topic.type_name; topic_description.topic_name = topic.m_topic_name; - fastdds::dds::xtypes::TypeIdentifierPair type_identifiers; - type_identifiers.type_identifier1(topic.type_identifiers.type_identifier1()); + // Check TypeIdentifierPair in DdsTopic is not empty + fastdds::dds::xtypes::TypeIdentifierPair empty_type_identifiers; + if (topic.type_identifiers == empty_type_identifiers) + { + return topic_description; + } // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; - if (fastdds::dds::RETCODE_OK == + + auto try_get_type_information = [&](const fastdds::dds::xtypes::TypeIdentifierPair& identifiers) -> bool { + return fastdds::dds::RETCODE_OK == fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - type_identifiers, - type_information)) + identifiers, type_information); + }; + + if (!try_get_type_information(topic.type_identifiers)) { - topic_description.type_information = type_information; + // If get_type_information fails with TypeIdentifierPair try just with complete + fastdds::dds::xtypes::TypeIdentifierPair complete_only; + complete_only.type_identifier1(topic.type_identifiers.type_identifier1()); + + if (!try_get_type_information(complete_only)) + { + // If get_type_information fails with complete TypeIdentifier try just with minimal + fastdds::dds::xtypes::TypeIdentifierPair minimal_only; + minimal_only.type_identifier2(topic.type_identifiers.type_identifier2()); + + if (!try_get_type_information(minimal_only)) + { + logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + "Failed to get TypeInformation for type " << topic.type_name); + + return topic_description; + } + } } + topic_description.type_information = type_information; + return topic_description; } diff --git a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp index b952a30a..e4a7bf08 100644 --- a/ddspipe_participants/src/cpp/xml/XmlHandler.cpp +++ b/ddspipe_participants/src/cpp/xml/XmlHandler.cpp @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - -// #include #include #include +#include + #include namespace eprosima { From a35d46eefbea911367cb4342a94a1e5524147e41 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 3 Sep 2024 10:38:27 +0200 Subject: [PATCH 31/53] Make payload_owner=nullptr in PayloadPool::release_ before empty() to avoid assertion failure Signed-off-by: Lucia Echevarria --- ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp index fc850fbb..4b767431 100644 --- a/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp +++ b/ddspipe_core/src/cpp/efficiency/payload/PayloadPool.cpp @@ -104,6 +104,7 @@ bool PayloadPool::release_( { logDebug(DDSPIPE_PAYLOADPOOL, "Releasing payload ptr: " << payload.data << "."); + payload.payload_owner = nullptr; payload.empty(); if (payload.data != nullptr) @@ -115,7 +116,6 @@ bool PayloadPool::release_( payload.length = 0; payload.max_size = 0; payload.data = nullptr; - payload.payload_owner = nullptr; payload.pos = 0; add_release_payload_(); From a0644383fd744c1a23d8552b6211bc4518c37b42 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Wed, 4 Sep 2024 08:27:39 +0200 Subject: [PATCH 32/53] Add assertion making sure TypeIdentifier is complete before calling add_schema Signed-off-by: Lucia Echevarria --- .../src/cpp/writer/dynamic_types/TypeObjectWriter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp index e5777a52..7222908a 100644 --- a/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/dynamic_types/TypeObjectWriter.cpp @@ -51,6 +51,7 @@ utils::ReturnCode TypeObjectWriter::write_nts_( // Add schema try { + assert(fastdds::dds::xtypes::EK_COMPLETE == dynamic_type_data.type_identifier._d()); schema_handler_->add_schema( dynamic_type_data.dynamic_type, dynamic_type_data.type_identifier); } From 9fc0456cffde2111804a40aade64da61fce4e16c Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Wed, 4 Sep 2024 15:47:42 +0200 Subject: [PATCH 33/53] Apply suggested changes Signed-off-by: Lucia Echevarria --- .../include/ddspipe_core/types/dynamic_types/types.hpp | 1 + ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp | 3 ++- .../participant/dds/CommonParticipant.hpp | 4 ++-- .../participant/dds/XmlParticipant.hpp | 2 +- .../src/cpp/participant/dds/CommonParticipant.cpp | 4 ++-- .../src/cpp/participant/dds/XmlParticipant.cpp | 2 +- .../cpp/participant/dynamic_types/DynTypesParticipant.cpp | 2 +- ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp | 7 +++---- ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp | 4 ++-- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp index 260693f6..275fe5bd 100644 --- a/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dynamic_types/types.hpp @@ -36,6 +36,7 @@ struct DynamicTypeData : public core::IRoutingData DDSPIPE_CORE_DllAPI virtual types::TopicInternalTypeDiscriminator internal_type_discriminator() const noexcept override; + // DynamicType created from a complete TypeObject fastdds::dds::DynamicType::_ref_type dynamic_type{nullptr}; // Complete TypeIdentifier of the DynamicType diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index 1abb5f3e..47c4bb7c 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -136,7 +136,8 @@ std::string container_kind_to_str( // TODO: Change exception -> RETCODE if (this_array_size.size() != 1) { - throw utils::InconsistencyException("Failed to convert container type: Multidimensional arrays are not supported in ROS2."); + throw utils::UnsupportedException( + STR_ENTRY << "Failed to convert container type: Multidimensional arrays are not supported in ROS2."); } std::stringstream ss; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index d8c38733..dc98181c 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -148,7 +148,7 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain virtual fastdds::dds::DomainParticipantQos - reckon_participant_qos_(); + reckon_participant_qos_() const; virtual fastdds::dds::DomainParticipant* @@ -157,7 +157,7 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain virtual fastdds::dds::DomainParticipantQos add_qos_properties_( - fastdds::dds::DomainParticipantQos& qos); + fastdds::dds::DomainParticipantQos& qos) const; ///////////////////////// // INTERNAL METHODS diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp index f2a6845c..3c687cac 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/XmlParticipant.hpp @@ -62,7 +62,7 @@ class XmlParticipant virtual fastdds::dds::DomainParticipantQos - reckon_participant_qos_() override; + reckon_participant_qos_() const override; ///////////////////////// // INTERNAL VARIABLES diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index 54f1b25b..a6b8817c 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -352,7 +352,7 @@ CommonParticipant::CommonParticipant( // Do nothing } -fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_() +fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_() const { auto qos = fastdds::dds::DomainParticipantFactory::get_instance()->get_default_participant_qos(); @@ -388,7 +388,7 @@ fastdds::dds::DomainParticipant* CommonParticipant::create_dds_participant_() } fastdds::dds::DomainParticipantQos CommonParticipant::add_qos_properties_( - fastdds::dds::DomainParticipantQos& qos) + fastdds::dds::DomainParticipantQos& qos) const { // Enforce ignore local endpoints on XML participants qos.properties().properties().emplace_back( diff --git a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp index 757ace43..38353996 100644 --- a/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/XmlParticipant.cpp @@ -84,7 +84,7 @@ std::shared_ptr XmlParticipant::create_reader( } } -fastdds::dds::DomainParticipantQos XmlParticipant::reckon_participant_qos_() +fastdds::dds::DomainParticipantQos XmlParticipant::reckon_participant_qos_() const { fastdds::dds::DomainParticipantQos qos = CommonParticipant::reckon_participant_qos_(); diff --git a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp index 29cffa8f..f2d60025 100644 --- a/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dynamic_types/DynTypesParticipant.cpp @@ -120,7 +120,7 @@ void DynTypesParticipant::notify_type_discovered_( if (received_types_.find(type_name) != received_types_.end()) { EPROSIMA_LOG_INFO(DDSPIPE_DYNTYPES_PARTICIPANT, - "Type " << type_name << " was already received"); + "Type " << type_name << " was already received, aborting propagation."); return; } diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index 9c3665a9..e8769ac2 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -332,8 +332,7 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( topic_description.type_name = topic.type_name; // Check TypeIdentifierPair in DdsTopic is not empty - fastdds::dds::xtypes::TypeIdentifierPair empty_type_identifiers; - if (topic.type_identifiers == empty_type_identifiers) + if (topic.type_identifiers == fastdds::dds::xtypes::TypeIdentifierPair()) { return topic_description; } @@ -361,7 +360,7 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( if (!try_get_type_information(minimal_only)) { - logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Failed to get TypeInformation for type " << topic.type_name); return topic_description; @@ -472,7 +471,7 @@ void CommonReader::on_requested_incompatible_qos( fastdds::rtps::RTPSReader*, eprosima::fastdds::dds::PolicyMask qos) noexcept { - logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "TOPIC_MISMATCH_QOS | Reader " << *this << " found a remote Writer with incompatible QoS: " << utils::qos_policy_mask_to_string(qos)); diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index f06e313d..f20df34a 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -144,7 +144,7 @@ void CommonWriter::on_offered_incompatible_qos( fastdds::rtps::RTPSWriter*, eprosima::fastdds::dds::PolicyMask qos) noexcept { - logWarning(DDSPIPE_RTPS_COMMONWRITER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONWRITER_LISTENER, "Writer " << *this << " found a remote Reader with incompatible QoS: " << utils::qos_policy_mask_to_string(qos)); } @@ -420,7 +420,7 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( if (!try_get_type_information(minimal_only)) { - logWarning(DDSPIPE_RTPS_COMMONREADER_LISTENER, + EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, "Failed to get TypeInformation for type " << topic.type_name); return topic_description; From 34c57cda888f41933264ecc648a94fbeab74378e Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Thu, 5 Sep 2024 19:20:25 +0200 Subject: [PATCH 34/53] Refactor rtps participants reckon_participant_attributes_ Signed-off-by: Lucia Echevarria --- .../participant/rtps/CommonParticipant.hpp | 16 ++++-- .../rtps/DiscoveryServerParticipant.hpp | 3 +- .../rtps/InitialPeersParticipant.hpp | 3 +- .../participant/rtps/SimpleParticipant.hpp | 3 +- .../participant/rtps/CommonParticipant.cpp | 31 ++++++----- .../rtps/DiscoveryServerParticipant.cpp | 53 ++++++++++--------- .../rtps/InitialPeersParticipant.cpp | 47 ++++++++-------- .../participant/rtps/SimpleParticipant.cpp | 25 ++++----- 8 files changed, 97 insertions(+), 84 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index c139f79b..484fb23f 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -194,8 +194,7 @@ class CommonParticipant const std::shared_ptr& participant_configuration, const std::shared_ptr& payload_pool, const std::shared_ptr& discovery_database, - const core::types::DomainId& domain_id, - const fastdds::rtps::RTPSParticipantAttributes& participant_attributes); + const core::types::DomainId& domain_id); /** * @brief Auxiliary method to create the internal RTPS participant. @@ -208,12 +207,19 @@ class CommonParticipant // RTPS specific methods /** - * @brief Static method that gives the std attributes for a Participant. + * @brief Virtual method that gives the common std attributes for a Participant. + * + * @note This method must be specialized from inherit classes. + */ + virtual fastdds::rtps::RTPSParticipantAttributes add_participant_att_properties_( + fastdds::rtps::RTPSParticipantAttributes& params) const; + + /** + * @brief Virtual method that gives the std attributes for a Participant. * * @note This method must be specialized from inherit classes. */ - static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( - const ParticipantConfiguration* participant_configuration); + virtual fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_() const; ///// // VARIABLES diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp index c33fe45d..e3640006 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp @@ -41,8 +41,7 @@ class DiscoveryServerParticipant protected: - static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( - const DiscoveryServerParticipantConfiguration* participant_configuration); + fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_() const override; }; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp index 0b11d86b..2eca30da 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp @@ -41,8 +41,7 @@ class InitialPeersParticipant protected: - static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( - const InitialPeersParticipantConfiguration* configuration); + fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_() const override; }; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp index 46774a1c..71459bbc 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/SimpleParticipant.hpp @@ -52,8 +52,7 @@ class SimpleParticipant : public CommonParticipant /** * @brief Static method that gives the attributes for a Simple Participant. */ - static fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_( - const SimpleParticipantConfiguration* configuration); + fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_() const override; }; } /* namespace rtps */ diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 914cdf9d..7d512abb 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -54,13 +54,11 @@ CommonParticipant::CommonParticipant( const std::shared_ptr& participant_configuration, const std::shared_ptr& payload_pool, const std::shared_ptr& discovery_database, - const core::types::DomainId& domain_id, - const fastdds::rtps::RTPSParticipantAttributes& participant_attributes) + const core::types::DomainId& domain_id) : configuration_(participant_configuration) , payload_pool_(payload_pool) , discovery_database_(discovery_database) , domain_id_(domain_id) - , participant_attributes_(participant_attributes) { // Do nothing } @@ -75,6 +73,7 @@ CommonParticipant::~CommonParticipant() void CommonParticipant::init() { + participant_attributes_ = reckon_participant_attributes_(); create_participant_( domain_id_, participant_attributes_); @@ -487,14 +486,9 @@ std::shared_ptr CommonParticipant::create_reader( } fastdds::rtps::RTPSParticipantAttributes -CommonParticipant::reckon_participant_attributes_( - const ParticipantConfiguration* participant_configuration) +CommonParticipant::add_participant_att_properties_( + fastdds::rtps::RTPSParticipantAttributes& params) const { - fastdds::rtps::RTPSParticipantAttributes params; - - // Add Participant name - params.setName(participant_configuration->id.c_str()); - // Ignore the local endpoints so that the reader and writer of the same participant don't match. params.properties.properties().emplace_back( "fastdds.ignore_local_endpoints", @@ -503,16 +497,29 @@ CommonParticipant::reckon_participant_attributes_( // Set app properties params.properties.properties().emplace_back( "fastdds.application.id", - participant_configuration->app_id, + configuration_->app_id, "true"); params.properties.properties().emplace_back( "fastdds.application.metadata", - participant_configuration->app_metadata, + configuration_->app_metadata, "true"); return params; } +fastdds::rtps::RTPSParticipantAttributes +CommonParticipant::reckon_participant_attributes_() const +{ + fastdds::rtps::RTPSParticipantAttributes params; + + // Add Participant name + params.setName(configuration_->id.c_str()); + + add_participant_att_properties_(params); + + return params; +} + } /* namespace rtps */ } /* namespace participants */ } /* namespace ddspipe */ diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index fb289f78..f5c6edff 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -38,21 +38,22 @@ DiscoveryServerParticipant::DiscoveryServerParticipant( participant_configuration, payload_pool, discovery_database, - participant_configuration->domain, - reckon_participant_attributes_(participant_configuration.get())) + participant_configuration->domain) { } fastdds::rtps::RTPSParticipantAttributes -DiscoveryServerParticipant::reckon_participant_attributes_( - const DiscoveryServerParticipantConfiguration* configuration) +DiscoveryServerParticipant::reckon_participant_attributes_() const { // Use default as base attributes - fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); + fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); + + std::shared_ptr ds_configuration = + std::static_pointer_cast(configuration_); // Auxiliary variable to save characters and improve readability - const core::types::GuidPrefix& discovery_server_guid_prefix = configuration->discovery_server_guid_prefix; - const auto& tls_config = configuration->tls_configuration; + const core::types::GuidPrefix& discovery_server_guid_prefix = ds_configuration->discovery_server_guid_prefix; + const auto& tls_config = ds_configuration->tls_configuration; // Needed values to check at the end if descriptor must be set bool has_listening_addresses = false; @@ -68,14 +69,14 @@ DiscoveryServerParticipant::reckon_participant_attributes_( ///// // Set listening addresses - for (types::Address address : configuration->listening_addresses) + for (types::Address address : ds_configuration->listening_addresses) { if (!address.is_valid()) { // Invalid address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard listening address: " << address << - " in Participant " << configuration->id << " initialization."); + " in Participant " << ds_configuration->id << " initialization."); continue; } @@ -121,7 +122,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( else { descriptor = create_descriptor( - configuration->whitelist); + ds_configuration->whitelist); descriptor->add_listener_port(address.port()); descriptor->set_WAN_address(address.ip()); @@ -140,7 +141,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( has_listening_tcp_ipv6 = true; std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ds_configuration->whitelist); descriptor->add_listener_port(address.port()); @@ -194,19 +195,19 @@ DiscoveryServerParticipant::reckon_participant_attributes_( params.defaultUnicastLocatorList.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Add listening address " << address << " to Participant " << configuration->id << "."); + "Add listening address " << address << " to Participant " << ds_configuration->id << "."); } ///// // Set connection addresses - for (types::DiscoveryServerConnectionAddress connection_address : configuration->connection_addresses) + for (types::DiscoveryServerConnectionAddress connection_address : ds_configuration->connection_addresses) { if (!connection_address.is_valid()) { // Invalid connection address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard connection address with remote server in Participant " << - configuration->id << " initialization."); + ds_configuration->id << " initialization."); continue; } @@ -217,7 +218,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( // Invalid ip address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard connection address with remote server due to invalid ip address " << - address.ip() << " in Participant " << configuration->id << + address.ip() << " in Participant " << ds_configuration->id << " initialization."); continue; } @@ -260,7 +261,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( params.builtin.discovery_config.m_DiscoveryServers.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Add connection address " << address << " to Server Participant " << configuration->id << "."); + "Add connection address " << address << " to Server Participant " << ds_configuration->id << "."); } } @@ -279,7 +280,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( if (!has_connection_addresses) { EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Creating Participant " << configuration->id << " without listening or connection addresses. " << + "Creating Participant " << ds_configuration->id << " without listening or connection addresses. " << "It will not communicate with any other Participant."); } } @@ -295,7 +296,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_( if (has_connection_tcp_ipv4 && !has_listening_tcp_ipv4) { std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ds_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -306,12 +307,12 @@ DiscoveryServerParticipant::reckon_participant_attributes_( params.userTransports.push_back(descriptor); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding TCPv4 Transport to Participant " << configuration->id << "."); + "Adding TCPv4 Transport to Participant " << ds_configuration->id << "."); } if (has_connection_tcp_ipv6 && !has_listening_tcp_ipv6) { std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ds_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -322,31 +323,31 @@ DiscoveryServerParticipant::reckon_participant_attributes_( params.userTransports.push_back(descriptor); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding TCPv6 Transport to Participant " << configuration->id << "."); + "Adding TCPv6 Transport to Participant " << ds_configuration->id << "."); } // If has UDP, create descriptor because it has not been created yet if (has_udp_ipv4) { std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ds_configuration->whitelist); params.userTransports.push_back(descriptor); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding UDPv4 Transport to Participant " << configuration->id << "."); + "Adding UDPv4 Transport to Participant " << ds_configuration->id << "."); } if (has_udp_ipv6) { std::shared_ptr descriptor_v6 = - create_descriptor(configuration->whitelist); + create_descriptor(ds_configuration->whitelist); params.userTransports.push_back(descriptor_v6); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding UDPv6 Transport to Participant " << configuration->id << "."); + "Adding UDPv6 Transport to Participant " << ds_configuration->id << "."); } logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Configured Participant " << configuration->id << " with server guid: " << + "Configured Participant " << ds_configuration->id << " with server guid: " << discovery_server_guid_prefix); return params; diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index 5e3d521d..61c7770f 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -34,19 +34,20 @@ InitialPeersParticipant::InitialPeersParticipant( participant_configuration, payload_pool, discovery_database, - participant_configuration->domain, - reckon_participant_attributes_(participant_configuration.get())) + participant_configuration->domain) { } -fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_participant_attributes_( - const InitialPeersParticipantConfiguration* configuration) +fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_participant_attributes_() const { // Use default as base attributes - fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); + fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); + + std::shared_ptr ip_configuration = + std::static_pointer_cast(configuration_); // Auxiliary variable to save characters and improve readability - const auto& tls_config = configuration->tls_configuration; + const auto& tls_config = ip_configuration->tls_configuration; // Needed values to check at the end if descriptor must be set bool has_listening_addresses = false; @@ -63,14 +64,14 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici ///// // Set listening addresses - for (const types::Address& address : configuration->listening_addresses) + for (const types::Address& address : ip_configuration->listening_addresses) { if (!address.is_valid()) { // Invalid address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_INITIALPEERS_PARTICIPANT, "Discard listening address: " << address << - " in Participant " << configuration->id << " initialization."); + " in Participant " << ip_configuration->id << " initialization."); continue; } @@ -116,7 +117,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici else { descriptor = create_descriptor( - configuration->whitelist); + ip_configuration->whitelist); descriptor->add_listener_port(address.port()); descriptor->set_WAN_address(address.ip()); @@ -135,7 +136,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici has_listening_tcp_ipv6 = true; std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ip_configuration->whitelist); descriptor->add_listener_port(address.port()); @@ -190,19 +191,19 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici params.defaultUnicastLocatorList.push_back(locator); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Add listening address " << address << " to Participant " << configuration->id << "."); + "Add listening address " << address << " to Participant " << ip_configuration->id << "."); } ///// // Set connection addresses - for (const types::Address& connection_address : configuration->connection_addresses) + for (const types::Address& connection_address : ip_configuration->connection_addresses) { if (!connection_address.is_valid()) { // Invalid connection address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_INITIALPEERS_PARTICIPANT, "Discard connection address: " << connection_address << - " in Participant " << configuration->id << " initialization."); + " in Participant " << ip_configuration->id << " initialization."); continue; } @@ -254,7 +255,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, "Add connection address " << connection_address << - " to Participant " << configuration->id << "."); + " to Participant " << ip_configuration->id << "."); } ///// @@ -264,7 +265,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici if (has_connection_tcp_ipv4 && !has_listening_tcp_ipv4) { std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ip_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -275,13 +276,13 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici params.userTransports.push_back(descriptor); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding TCPv4 Transport to Participant " << configuration->id << "."); + "Adding TCPv4 Transport to Participant " << ip_configuration->id << "."); } if (has_connection_tcp_ipv6 && !has_listening_tcp_ipv6) { std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ip_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -292,28 +293,28 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici params.userTransports.push_back(descriptor); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding TCPv6 Transport to Participant " << configuration->id << "."); + "Adding TCPv6 Transport to Participant " << ip_configuration->id << "."); } // If has UDP, create descriptor because it has not been created yet if (has_udp_ipv4) { std::shared_ptr descriptor = - create_descriptor(configuration->whitelist); + create_descriptor(ip_configuration->whitelist); params.userTransports.push_back(descriptor); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding UDPv4 Transport to Participant " << configuration->id << "."); + "Adding UDPv4 Transport to Participant " << ip_configuration->id << "."); } if (has_udp_ipv6) { std::shared_ptr descriptor_v6 = - create_descriptor(configuration->whitelist); + create_descriptor(ip_configuration->whitelist); params.userTransports.push_back(descriptor_v6); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding UDPv6 Transport to Participant " << configuration->id << "."); + "Adding UDPv6 Transport to Participant " << ip_configuration->id << "."); } // To avoid creating a multicast transport in UDP when non listening addresses @@ -336,7 +337,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici } logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Configured Participant " << configuration->id); + "Configured Participant " << ip_configuration->id); return params; } diff --git a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp index 30d21e64..2312821e 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp @@ -35,22 +35,23 @@ SimpleParticipant::SimpleParticipant( participant_configuration, payload_pool, discovery_database, - participant_configuration->domain, - reckon_participant_attributes_(participant_configuration.get())) + participant_configuration->domain) { } fastdds::rtps::RTPSParticipantAttributes -SimpleParticipant::reckon_participant_attributes_( - const SimpleParticipantConfiguration* configuration) +SimpleParticipant::reckon_participant_attributes_() const { // Use default as base attributes - fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(configuration); + fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); + + std::shared_ptr simple_configuration = + std::static_pointer_cast(configuration_); // Configure Participant transports - if (configuration->transport == core::types::TransportDescriptors::builtin) + if (simple_configuration->transport == core::types::TransportDescriptors::builtin) { - if (!configuration->whitelist.empty()) + if (!simple_configuration->whitelist.empty()) { params.useBuiltinTransports = false; @@ -59,11 +60,11 @@ SimpleParticipant::reckon_participant_attributes_( params.userTransports.push_back(shm_transport); std::shared_ptr udp_transport = - create_descriptor(configuration->whitelist); + create_descriptor(simple_configuration->whitelist); params.userTransports.push_back(udp_transport); } } - else if (configuration->transport == core::types::TransportDescriptors::shm_only) + else if (simple_configuration->transport == core::types::TransportDescriptors::shm_only) { params.useBuiltinTransports = false; @@ -71,17 +72,17 @@ SimpleParticipant::reckon_participant_attributes_( std::make_shared(); params.userTransports.push_back(shm_transport); } - else if (configuration->transport == core::types::TransportDescriptors::udp_only) + else if (simple_configuration->transport == core::types::TransportDescriptors::udp_only) { params.useBuiltinTransports = false; std::shared_ptr udp_transport = - create_descriptor(configuration->whitelist); + create_descriptor(simple_configuration->whitelist); params.userTransports.push_back(udp_transport); } // Participant discovery filter configuration - switch (configuration->ignore_participant_flags) + switch (simple_configuration->ignore_participant_flags) { case core::types::IgnoreParticipantFlags::no_filter: params.builtin.discovery_config.ignoreParticipantFlags = From 3d370e78c18af24fe98ab871026b01d52b39bcea Mon Sep 17 00:00:00 2001 From: juanlofer-eprosima <88179026+juanlofer-eprosima@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:54:56 +0200 Subject: [PATCH 35/53] Accept v6 interfaces and interface names in whitelist (#128) Signed-off-by: Juan Lopez Fernandez --- .../SimpleParticipantConfiguration.hpp | 2 +- .../participant/rtps/CommonParticipant.hpp | 2 +- .../types/address/Address.hpp | 2 + .../SimpleParticipantConfiguration.cpp | 10 --- .../participant/rtps/CommonParticipant.cpp | 76 +++++-------------- .../src/cpp/YamlReader_participants.cpp | 9 ++- 6 files changed, 30 insertions(+), 71 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp b/ddspipe_participants/include/ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp index 37fe7def..34615fff 100644 --- a/ddspipe_participants/include/ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp +++ b/ddspipe_participants/include/ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp @@ -51,7 +51,7 @@ struct SimpleParticipantConfiguration : public ParticipantConfiguration core::types::DomainId domain {0u}; - std::set whitelist {}; + std::set whitelist {}; core::types::TransportDescriptors transport {core::types::TransportDescriptors::builtin}; diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index 484fb23f..e6400ccd 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -181,7 +181,7 @@ class CommonParticipant template DDSPIPE_PARTICIPANTS_DllAPI static std::shared_ptr create_descriptor( - std::set whitelist = {}); + std::set whitelist = {}); protected: diff --git a/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp b/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp index 3770fb80..7a75dbc4 100644 --- a/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp +++ b/ddspipe_participants/include/ddspipe_participants/types/address/Address.hpp @@ -29,6 +29,8 @@ namespace types { using LocatorType = uint32_t; // Data Type for IP using IpType = std::string; +// Data Type for an interfaces whitelist entry +using WhitelistType = std::string; // Data Type for Domain name (DNS) using DomainType = std::string; // Data Type for Port diff --git a/ddspipe_participants/src/cpp/configuration/SimpleParticipantConfiguration.cpp b/ddspipe_participants/src/cpp/configuration/SimpleParticipantConfiguration.cpp index b7ac65ae..65e9d6e6 100644 --- a/ddspipe_participants/src/cpp/configuration/SimpleParticipantConfiguration.cpp +++ b/ddspipe_participants/src/cpp/configuration/SimpleParticipantConfiguration.cpp @@ -35,16 +35,6 @@ bool SimpleParticipantConfiguration::is_valid( return false; } - // Check whitelist interfaces - for (types::IpType ip : whitelist) - { - if (!types::Address::is_ipv4_correct(ip)) - { - error_msg << "Incorrect IPv4 address " << ip << " in whitelist interfaces. "; - return false; - } - } - return true; } diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 7d512abb..06ffe500 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -211,25 +211,16 @@ template<> DDSPIPE_PARTICIPANTS_DllAPI std::shared_ptr CommonParticipant::create_descriptor( - std::set whitelist) + std::set whitelist) { std::shared_ptr udp_transport = std::make_shared(); - for (const types::IpType& ip : whitelist) + for (const types::WhitelistType& iface : whitelist) { - if (types::Address::is_ipv4_correct(ip)) - { - udp_transport->interfaceWhiteList.emplace_back(ip); - EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, - "Adding " << ip << " to UDP whitelist interfaces."); - } - else - { - // Invalid address, continue with next one - EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, - "Not valid IPv4. Discarding UDP whitelist interface " << ip << "."); - } + udp_transport->interfaceWhiteList.emplace_back(iface); + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, + "Adding " << iface << " to UDP whitelist interfaces."); } return udp_transport; @@ -239,25 +230,16 @@ template<> DDSPIPE_PARTICIPANTS_DllAPI std::shared_ptr CommonParticipant::create_descriptor( - std::set whitelist) + std::set whitelist) { std::shared_ptr udp_transport = std::make_shared(); - for (const types::IpType& ip : whitelist) + for (const types::WhitelistType& iface : whitelist) { - if (types::Address::is_ipv6_correct(ip)) - { - udp_transport->interfaceWhiteList.emplace_back(ip); - EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, - "Adding " << ip << " to UDP whitelist interfaces."); - } - else - { - // Invalid address, continue with next one - EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, - "Not valid IPv6. Discarding UDP whitelist interface " << ip << "."); - } + udp_transport->interfaceWhiteList.emplace_back(iface); + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, + "Adding " << iface << " to UDP whitelist interfaces."); } return udp_transport; @@ -267,25 +249,16 @@ template<> DDSPIPE_PARTICIPANTS_DllAPI std::shared_ptr CommonParticipant::create_descriptor( - std::set whitelist) + std::set whitelist) { std::shared_ptr tcp_transport = std::make_shared(); - for (const types::IpType& ip : whitelist) + for (const types::WhitelistType& iface : whitelist) { - if (types::Address::is_ipv4_correct(ip)) - { - tcp_transport->interfaceWhiteList.emplace_back(ip); - EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, - "Adding " << ip << " to TCP whitelist interfaces."); - } - else - { - // Invalid address, continue with next one - EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, - "Not valid IPv4. Discarding TCP whitelist interface " << ip << "."); - } + tcp_transport->interfaceWhiteList.emplace_back(iface); + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, + "Adding " << iface << " to TCP whitelist interfaces."); } return tcp_transport; @@ -295,25 +268,16 @@ template<> DDSPIPE_PARTICIPANTS_DllAPI std::shared_ptr CommonParticipant::create_descriptor( - std::set whitelist) + std::set whitelist) { std::shared_ptr tcp_transport = std::make_shared(); - for (const types::IpType& ip : whitelist) + for (const types::WhitelistType& iface : whitelist) { - if (types::Address::is_ipv6_correct(ip)) - { - tcp_transport->interfaceWhiteList.emplace_back(ip); - EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, - "Adding " << ip << " to TCP whitelist interfaces."); - } - else - { - // Invalid address, continue with next one - EPROSIMA_LOG_WARNING(DDSPIPE_COMMON_PARTICIPANT, - "Not valid IPv6. Discarding TCP whitelist interface " << ip << "."); - } + tcp_transport->interfaceWhiteList.emplace_back(iface); + EPROSIMA_LOG_INFO(DDSPIPE_COMMON_PARTICIPANT, + "Adding " << iface << " to TCP whitelist interfaces."); } return tcp_transport; diff --git a/ddspipe_yaml/src/cpp/YamlReader_participants.cpp b/ddspipe_yaml/src/cpp/YamlReader_participants.cpp index e1ae6e67..d2def0e8 100644 --- a/ddspipe_yaml/src/cpp/YamlReader_participants.cpp +++ b/ddspipe_yaml/src/cpp/YamlReader_participants.cpp @@ -137,7 +137,8 @@ void YamlReader::fill( // Optional whitelist interfaces if (YamlReader::is_tag_present(yml, WHITELIST_INTERFACES_TAG)) { - object.whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, version); + object.whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, + version); } // Optional get Transport descriptors @@ -194,7 +195,8 @@ void YamlReader::fill( // Optional whitelist interfaces if (YamlReader::is_tag_present(yml, WHITELIST_INTERFACES_TAG)) { - object.whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, version); + object.whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, + version); } // Optional listening addresses @@ -262,7 +264,8 @@ void YamlReader::fill( // Optional whitelist interfaces if (YamlReader::is_tag_present(yml, WHITELIST_INTERFACES_TAG)) { - object.whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, version); + object.whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, + version); } // Optional listening addresses From 5cce977e5d244e097de4a8864a7b83722b4d92c8 Mon Sep 17 00:00:00 2001 From: juanlofer-eprosima <88179026+juanlofer-eprosima@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:26:57 +0200 Subject: [PATCH 36/53] Make DiscoveryServer servers' guid prefix optional (#129) * Make DiscoveryServer servers' guid prefix optional Signed-off-by: Juan Lopez Fernandez * Raise YAML reader version Signed-off-by: Juan Lopez Fernandez * BONUS: improve participant discovery traces Signed-off-by: Juan Lopez Fernandez --------- Signed-off-by: Juan Lopez Fernandez --- .../ddspipe_core/types/dds/GuidPrefix.hpp | 4 +-- ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp | 2 +- ...iscoveryServerParticipantConfiguration.cpp | 7 ---- .../cpp/participant/dds/CommonParticipant.cpp | 31 +++++++++++------ .../participant/rtps/CommonParticipant.cpp | 33 +++++++++++++------ .../include/ddspipe_yaml/YamlReader.hpp | 21 ++++++++---- .../ddspipe_yaml/yaml_configuration_tags.hpp | 1 + .../src/cpp/YamlReader_participants.cpp | 14 +++++++- ddspipe_yaml/src/cpp/YamlReader_types.cpp | 24 ++++++++++---- 9 files changed, 93 insertions(+), 44 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp index c71c484a..1b5c92ca 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp @@ -75,12 +75,12 @@ class GuidPrefix : public fastdds::rtps::GuidPrefix_t * * @todo use the seed of \c id to modify the whole guid and not only one of the 12 values. * - * @param ros : whether to use the Discovery Server ROS2 specific guid [Default: false] + * @param ros : whether to use the Discovery Server ROS2 specific guid * @param id : number to seed for the final Guid Prefix [Default: 0] */ DDSPIPE_CORE_DllAPI GuidPrefix ( - bool ros = false, + bool ros, uint32_t id = 0) noexcept; /** diff --git a/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp b/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp index 56fbaa12..1a7ffb95 100644 --- a/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp +++ b/ddspipe_core/src/cpp/types/dds/GuidPrefix.cpp @@ -41,7 +41,7 @@ GuidPrefix::GuidPrefix ( } GuidPrefix::GuidPrefix ( - bool ros /*= false*/, + bool ros, uint32_t id /*= 0*/) noexcept { if (ros) diff --git a/ddspipe_participants/src/cpp/configuration/DiscoveryServerParticipantConfiguration.cpp b/ddspipe_participants/src/cpp/configuration/DiscoveryServerParticipantConfiguration.cpp index 0af034b3..65308bf2 100644 --- a/ddspipe_participants/src/cpp/configuration/DiscoveryServerParticipantConfiguration.cpp +++ b/ddspipe_participants/src/cpp/configuration/DiscoveryServerParticipantConfiguration.cpp @@ -33,13 +33,6 @@ bool DiscoveryServerParticipantConfiguration::is_valid( return false; } - // Check DS Guid Prefix - if (!discovery_server_guid_prefix.is_valid()) - { - error_msg << "Non valid Participant Guid Prefix " << discovery_server_guid_prefix << ". "; - return false; - } - // Check listening addresses for (types::Address address : listening_addresses) { diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index a6b8817c..ec65d088 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -230,19 +230,24 @@ void CommonParticipant::on_participant_discovery( } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << + " changed QoS."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " removed."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " dropped."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::IGNORED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " ignored."); } } } @@ -275,20 +280,23 @@ void CommonParticipant::on_data_reader_discovery( } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::IGNORED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -322,20 +330,23 @@ void CommonParticipant::on_data_writer_discovery( } else if (reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::IGNORED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } diff --git a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp index 06ffe500..a8caea41 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/CommonParticipant.cpp @@ -94,19 +94,24 @@ void CommonParticipant::on_participant_discovery( } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " changed QoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << + " changed QoS."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " removed."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " dropped."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " dropped."); } else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::IGNORED_PARTICIPANT) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Participant " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Participant " << info.guid << " ignored."); } } } @@ -132,20 +137,24 @@ void CommonParticipant::on_reader_discovery( } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << + " changed TopicQoS."); this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " removed."); info_reader.active = false; this->discovery_database_->update_endpoint(info_reader); } else if (reason == fastdds::rtps::ReaderDiscoveryStatus::IGNORED_READER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Reader " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Reader " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } @@ -173,20 +182,24 @@ void CommonParticipant::on_writer_discovery( } else if (reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " changed TopicQoS."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << + " changed TopicQoS."); this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " removed."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " removed."); info_writer.active = false; this->discovery_database_->update_endpoint(info_writer); } else if (reason == fastdds::rtps::WriterDiscoveryStatus::IGNORED_WRITER) { - EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, "Writer " << info.guid << " ignored."); + EPROSIMA_LOG_INFO(DDSPIPE_DISCOVERY, + configuration_->id << " participant : " << "Writer " << info.guid << " ignored."); // Do not notify discovery database (design choice that might be changed in the future) } diff --git a/ddspipe_yaml/include/ddspipe_yaml/YamlReader.hpp b/ddspipe_yaml/include/ddspipe_yaml/YamlReader.hpp index 3a7b94f7..467b1fe0 100644 --- a/ddspipe_yaml/include/ddspipe_yaml/YamlReader.hpp +++ b/ddspipe_yaml/include/ddspipe_yaml/YamlReader.hpp @@ -51,14 +51,13 @@ enum YamlReaderVersion * @brief First version. * * @version 0.1.0 - * @version 0.2.0 */ V_1_0, /** * @brief Version 2.0 * - * @version 0.3.0 + * @version 0.1.0 * * - Adds builtin-topics tag. * - Adds participants list. @@ -70,7 +69,7 @@ enum YamlReaderVersion /** * @brief Version 3.0 * - * @version 0.4.0 + * @version 0.1.0 * * - Change wan to initial peers participant * - Add Specs @@ -80,7 +79,7 @@ enum YamlReaderVersion /** * @brief Version 3.1. * - * @version 0.5.0 + * @version 0.2.0 * * - Add XML load by file or raw * - Add xml participant @@ -88,9 +87,9 @@ enum YamlReaderVersion V_3_1, /** - * @brief Latest version. + * @brief Version 4.0. * - * @version 0.6.0 + * @version 0.3.0 * * - Forwarding Routes. * - Remove Unused Entities. @@ -102,6 +101,16 @@ enum YamlReaderVersion */ V_4_0, + /** + * @brief Latest version. + * + * @version 1.0.0 + * + * - Make discovery server's guid prefix optional. + * - Remove server's guid prefix from discovery server clients' connection addresses. + */ + V_5_0, + /** * @brief Main version. * diff --git a/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp b/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp index bafd666d..cd84c6f0 100644 --- a/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp +++ b/ddspipe_yaml/include/ddspipe_yaml/yaml_configuration_tags.hpp @@ -28,6 +28,7 @@ constexpr const char* VERSION_TAG_V_2_0("v2.0"); //! Version v2.0 constexpr const char* VERSION_TAG_V_3_0("v3.0"); //! Version v3.0 constexpr const char* VERSION_TAG_V_3_1("v3.1"); //! Version v3.1 constexpr const char* VERSION_TAG_V_4_0("v4.0"); //! Version v4.0 +constexpr const char* VERSION_TAG_V_5_0("v5.0"); //! Version v5.0 // Topics related tags constexpr const char* ALLOWLIST_TAG("allowlist"); //! List of allowed topics diff --git a/ddspipe_yaml/src/cpp/YamlReader_participants.cpp b/ddspipe_yaml/src/cpp/YamlReader_participants.cpp index d2def0e8..8cce876b 100644 --- a/ddspipe_yaml/src/cpp/YamlReader_participants.cpp +++ b/ddspipe_yaml/src/cpp/YamlReader_participants.cpp @@ -231,10 +231,22 @@ void YamlReader::fill( YamlReader::get(yml, version); break; - default: + case V_2_0: + case V_3_0: + case V_3_1: + case V_4_0: object.discovery_server_guid_prefix = YamlReader::get(yml, DISCOVERY_SERVER_GUID_PREFIX_TAG, version); break; + + case V_5_0: + default: + if (YamlReader::is_tag_present(yml, DISCOVERY_SERVER_GUID_PREFIX_TAG)) + { + object.discovery_server_guid_prefix = + YamlReader::get(yml, DISCOVERY_SERVER_GUID_PREFIX_TAG, version); + } + break; } } diff --git a/ddspipe_yaml/src/cpp/YamlReader_types.cpp b/ddspipe_yaml/src/cpp/YamlReader_types.cpp index 9c34621c..cbadb8ef 100644 --- a/ddspipe_yaml/src/cpp/YamlReader_types.cpp +++ b/ddspipe_yaml/src/cpp/YamlReader_types.cpp @@ -98,6 +98,7 @@ YamlReaderVersion YamlReader::get( {VERSION_TAG_V_3_0, YamlReaderVersion::V_3_0}, {VERSION_TAG_V_3_1, YamlReaderVersion::V_3_1}, {VERSION_TAG_V_4_0, YamlReaderVersion::V_4_0}, + {VERSION_TAG_V_5_0, YamlReaderVersion::V_5_0}, }); } @@ -165,24 +166,29 @@ GuidPrefix YamlReader::get( } // ROS DS is optional. - bool ros_id; + bool ros_id = false; bool ros_id_set = is_tag_present(yml, DISCOVERY_SERVER_ID_ROS_TAG); if (ros_id_set) { ros_id = get_scalar(yml, DISCOVERY_SERVER_ID_ROS_TAG); } - // Id is mandatory if guid is not present - uint32_t id = get_scalar(yml, DISCOVERY_SERVER_ID_TAG); + // Id is optional. + uint32_t id = 0; + bool id_set = is_tag_present(yml, DISCOVERY_SERVER_ID_TAG); + if (id_set) + { + id = get_scalar(yml, DISCOVERY_SERVER_ID_TAG); + } - // Create GuidPrefix - if (ros_id_set) + if (ros_id_set || id_set) { return GuidPrefix(ros_id, id); } else { - return GuidPrefix(id); + // Return unknown prefix -> delegate assignment on Fast-DDS + return GuidPrefix(); } } @@ -776,10 +782,14 @@ std::ostream& operator <<( break; case V_4_0: - case LATEST: os << VERSION_TAG_V_4_0; break; + case V_5_0: + case LATEST: + os << VERSION_TAG_V_5_0; + break; + default: utils::tsnh(STR_ENTRY << "Value of YamlReaderVersion out of enumeration."); break; From 1a0295c0313fd89029b82f7abffa8d0b07b8005c Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 09:50:31 +0200 Subject: [PATCH 37/53] Add missing suggested changes Signed-off-by: Lucia Echevarria --- .../efficiency/MapPayloadPoolTest.cpp | 1 - .../src/cpp/writer/rpc/SimpleWriter.cpp | 4 ++-- .../src/cpp/writer/rtps/CommonWriter.cpp | 24 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp index ecef079a..ac025eec 100644 --- a/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/MapPayloadPoolTest.cpp @@ -259,7 +259,6 @@ TEST(MapPayloadPoolTest, get_payload_from_src_negative) { eprosima::fastdds::rtps::IPayloadPool* pool = new test::MockMapPayloadPool(); // Requires to be ptr to pass it to get_payload test::MockMapPayloadPool* pool_ = static_cast(pool); - eprosima::fastdds::rtps::IPayloadPool* pool_aux = nullptr; // nullptr Payload payload_src; Payload payload_target; diff --git a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp index 43df6eb4..3a8cd234 100644 --- a/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rpc/SimpleWriter.cpp @@ -52,7 +52,7 @@ SimpleWriter::SimpleWriter( utils::ReturnCode SimpleWriter::fill_to_send_data_( fastdds::rtps::CacheChange_t* to_send_change_to_fill, - eprosima::fastdds::rtps::WriteParams& to_send_params, + fastdds::rtps::WriteParams& to_send_params, const core::types::RtpsPayloadData& data) const noexcept { CommonWriter::fill_to_send_data_( @@ -70,7 +70,7 @@ utils::ReturnCode SimpleWriter::fill_to_send_data_( } void SimpleWriter::fill_sent_data_( - const eprosima::fastdds::rtps::WriteParams& sent_params, + const fastdds::rtps::WriteParams& sent_params, core::types::RtpsPayloadData& data_to_fill) const noexcept { CommonWriter::fill_sent_data_( diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index f20df34a..b239713d 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -142,7 +142,7 @@ void CommonWriter::on_writer_change_received_by_all( void CommonWriter::on_offered_incompatible_qos( fastdds::rtps::RTPSWriter*, - eprosima::fastdds::dds::PolicyMask qos) noexcept + fastdds::dds::PolicyMask qos) noexcept { EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONWRITER_LISTENER, "Writer " << *this << " found a remote Reader with incompatible QoS: " << @@ -193,7 +193,7 @@ utils::ReturnCode CommonWriter::write_nts_( rtps_data.source_guid); // Get params to write (if set) - eprosima::fastdds::rtps::WriteParams write_params; + fastdds::rtps::WriteParams write_params; // Fill cache change with specific data to send auto ret = fill_to_send_data_(new_change, write_params, rtps_data); @@ -216,7 +216,7 @@ utils::ReturnCode CommonWriter::write_nts_( utils::ReturnCode CommonWriter::fill_to_send_data_( fastdds::rtps::CacheChange_t* to_send_change_to_fill, - eprosima::fastdds::rtps::WriteParams& to_send_params, + fastdds::rtps::WriteParams& to_send_params, const RtpsPayloadData& data) const noexcept { if (repeater_) @@ -255,7 +255,7 @@ utils::ReturnCode CommonWriter::fill_to_send_data_( } void CommonWriter::fill_sent_data_( - const eprosima::fastdds::rtps::WriteParams& params, + const fastdds::rtps::WriteParams& params, core::types::RtpsPayloadData& data_to_fill) const noexcept { // Do nothing @@ -340,7 +340,7 @@ fastdds::rtps::HistoryAttributes CommonWriter::reckon_history_attributes_( fastdds::rtps::HistoryAttributes att; att.memoryPolicy = - eprosima::fastdds::rtps::MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; + fastdds::rtps::MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; att.maximumReservedCaches = topic.topic_qos.history_depth; if (att.maximumReservedCaches > 0 && att.initialReservedCaches > att.maximumReservedCaches) @@ -366,11 +366,11 @@ fastdds::rtps::WriterAttributes CommonWriter::reckon_writer_attributes_( // Set if topic has key if (topic.topic_qos.keyed) { - att.endpoint.topicKind = eprosima::fastdds::rtps::WITH_KEY; + att.endpoint.topicKind = fastdds::rtps::WITH_KEY; } else { - att.endpoint.topicKind = eprosima::fastdds::rtps::NO_KEY; + att.endpoint.topicKind = fastdds::rtps::NO_KEY; } // Other attributes as partitions and ownership are not used in this writer @@ -441,17 +441,17 @@ fastdds::dds::WriterQos CommonWriter::reckon_writer_qos_( // Set Durability qos.m_durability.kind = (topic.topic_qos.is_transient_local() - ? eprosima::fastdds::dds::DurabilityQosPolicyKind_t::TRANSIENT_LOCAL_DURABILITY_QOS - : eprosima::fastdds::dds::DurabilityQosPolicyKind_t::VOLATILE_DURABILITY_QOS); + ? fastdds::dds::DurabilityQosPolicyKind_t::TRANSIENT_LOCAL_DURABILITY_QOS + : fastdds::dds::DurabilityQosPolicyKind_t::VOLATILE_DURABILITY_QOS); // Set Reliability qos.m_reliability.kind = (topic.topic_qos.is_reliable() - ? eprosima::fastdds::dds::ReliabilityQosPolicyKind::RELIABLE_RELIABILITY_QOS - : eprosima::fastdds::dds::ReliabilityQosPolicyKind::BEST_EFFORT_RELIABILITY_QOS); + ? fastdds::dds::ReliabilityQosPolicyKind::RELIABLE_RELIABILITY_QOS + : fastdds::dds::ReliabilityQosPolicyKind::BEST_EFFORT_RELIABILITY_QOS); // Set minimum deadline so it matches with everything - qos.m_deadline.period = eprosima::fastdds::dds::Duration_t(0); + qos.m_deadline.period = fastdds::dds::Duration_t(0); // Partitions and specific ownership strength are not set in common. From 80cca3a8fd3e4a996db471ba549539dd5b900248 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 11:05:28 +0200 Subject: [PATCH 38/53] Correct type_kind_to_str output for TK_CHAR8 case Signed-off-by: Lucia Echevarria --- ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index 47c4bb7c..f699bd8b 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -207,7 +207,7 @@ std::string type_kind_to_str( return "float64"; case fastdds::dds::xtypes::TK_CHAR8: - return "int8"; + return "char"; case fastdds::dds::xtypes::TK_STRING8: return "string"; From 2df989c27ba4243390c93af5ca7d9ee5e332f330 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 11:06:23 +0200 Subject: [PATCH 39/53] Remove unnecessary CacheChange include Signed-off-by: Lucia Echevarria --- ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp index 9eaa5612..7add4958 100644 --- a/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp +++ b/ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include From 9534f79b23507d33abb692b89c9a1aa5933b3381 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 11:07:26 +0200 Subject: [PATCH 40/53] Implement add_qos_properties_ in reckon_participant_qos_ Signed-off-by: Lucia Echevarria --- .../participant/dds/CommonParticipant.hpp | 10 +++--- .../cpp/participant/dds/CommonParticipant.cpp | 36 +++++++------------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp index dc98181c..669cd04f 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/dds/CommonParticipant.hpp @@ -146,6 +146,11 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain // INTERNAL VIRTUAL METHODS ///////////////////////// + virtual + fastdds::dds::DomainParticipantQos + add_qos_properties_( + fastdds::dds::DomainParticipantQos& qos) const; + virtual fastdds::dds::DomainParticipantQos reckon_participant_qos_() const; @@ -154,11 +159,6 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain fastdds::dds::DomainParticipant* create_dds_participant_(); - virtual - fastdds::dds::DomainParticipantQos - add_qos_properties_( - fastdds::dds::DomainParticipantQos& qos) const; - ///////////////////////// // INTERNAL METHODS ///////////////////////// diff --git a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp index ec65d088..bb40db1e 100644 --- a/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/dds/CommonParticipant.cpp @@ -363,10 +363,10 @@ CommonParticipant::CommonParticipant( // Do nothing } -fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_() const +fastdds::dds::DomainParticipantQos CommonParticipant::add_qos_properties_( + fastdds::dds::DomainParticipantQos& qos) const { - auto qos = fastdds::dds::DomainParticipantFactory::get_instance()->get_default_participant_qos(); - + // Enforce ignore local endpoints on XML participants qos.properties().properties().emplace_back( "fastdds.ignore_local_endpoints", "true"); @@ -384,6 +384,15 @@ fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_() return qos; } +fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_() const +{ + auto qos = fastdds::dds::DomainParticipantFactory::get_instance()->get_default_participant_qos(); + + add_qos_properties_(qos); + + return qos; +} + fastdds::dds::DomainParticipant* CommonParticipant::create_dds_participant_() { // Set listener mask so reader read its own messages @@ -398,27 +407,6 @@ fastdds::dds::DomainParticipant* CommonParticipant::create_dds_participant_() mask); } -fastdds::dds::DomainParticipantQos CommonParticipant::add_qos_properties_( - fastdds::dds::DomainParticipantQos& qos) const -{ - // Enforce ignore local endpoints on XML participants - qos.properties().properties().emplace_back( - "fastdds.ignore_local_endpoints", - "true"); - - // Set app properties - qos.properties().properties().emplace_back( - "fastdds.application.id", - configuration_->app_id, - "true"); - qos.properties().properties().emplace_back( - "fastdds.application.metadata", - configuration_->app_metadata, - "true"); - - return qos; -} - fastdds::dds::Topic* CommonParticipant::topic_related_( const core::types::DdsTopic& topic) { From 44c01d7df1cc97355df2fa9b6d3c55b05cf1c419 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 11:14:44 +0200 Subject: [PATCH 41/53] Remove Fast-DDS API ReturnCode explanation in PayloadPoolMediator::write Signed-off-by: Lucia Echevarria --- .../ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp index 5f318094..0c36e91f 100644 --- a/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp +++ b/ddspipe_core/include/ddspipe_core/efficiency/payload/PayloadPoolMediator.hpp @@ -113,8 +113,7 @@ class PayloadPoolMediator : public fastdds::rtps::IPayloadPool * @param data the data to be written by the \c writer. * @param handle the data to be used by the \c writer. * - * @return ReturnCode::PRECONDITION_NOT_MET if the handle introduced does not match with the one associated to the - * data, ReturnCode::OK if the data is correctly sent and ReturnCode::ERROR otherwise. + * @return ReturnCode::OK if the data is correctly sent, ReturnCode::PRECONDITION_NOT_MET or ReturnCode::ERROR otherwise. */ DDSPIPE_CORE_DllAPI utils::ReturnCode write( From 7e12adcb4b96a75b326b2786faf278452a430045 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 11:22:50 +0200 Subject: [PATCH 42/53] Change name ip_configuration -> initial_peers_configuration Signed-off-by: Lucia Echevarria --- .../rtps/InitialPeersParticipant.cpp | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index 61c7770f..99adbb06 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -43,11 +43,11 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici // Use default as base attributes fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); - std::shared_ptr ip_configuration = + std::shared_ptr initial_peers_configuration = std::static_pointer_cast(configuration_); // Auxiliary variable to save characters and improve readability - const auto& tls_config = ip_configuration->tls_configuration; + const auto& tls_config = initial_peers_configuration->tls_configuration; // Needed values to check at the end if descriptor must be set bool has_listening_addresses = false; @@ -64,14 +64,14 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici ///// // Set listening addresses - for (const types::Address& address : ip_configuration->listening_addresses) + for (const types::Address& address : initial_peers_configuration->listening_addresses) { if (!address.is_valid()) { // Invalid address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_INITIALPEERS_PARTICIPANT, "Discard listening address: " << address << - " in Participant " << ip_configuration->id << " initialization."); + " in Participant " << initial_peers_configuration->id << " initialization."); continue; } @@ -117,7 +117,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici else { descriptor = create_descriptor( - ip_configuration->whitelist); + initial_peers_configuration->whitelist); descriptor->add_listener_port(address.port()); descriptor->set_WAN_address(address.ip()); @@ -136,7 +136,8 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici has_listening_tcp_ipv6 = true; std::shared_ptr descriptor = - create_descriptor(ip_configuration->whitelist); + create_descriptor( + initial_peers_configuration->whitelist); descriptor->add_listener_port(address.port()); @@ -191,19 +192,19 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici params.defaultUnicastLocatorList.push_back(locator); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Add listening address " << address << " to Participant " << ip_configuration->id << "."); + "Add listening address " << address << " to Participant " << initial_peers_configuration->id << "."); } ///// // Set connection addresses - for (const types::Address& connection_address : ip_configuration->connection_addresses) + for (const types::Address& connection_address : initial_peers_configuration->connection_addresses) { if (!connection_address.is_valid()) { // Invalid connection address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_INITIALPEERS_PARTICIPANT, "Discard connection address: " << connection_address << - " in Participant " << ip_configuration->id << " initialization."); + " in Participant " << initial_peers_configuration->id << " initialization."); continue; } @@ -255,7 +256,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, "Add connection address " << connection_address << - " to Participant " << ip_configuration->id << "."); + " to Participant " << initial_peers_configuration->id << "."); } ///// @@ -265,7 +266,8 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici if (has_connection_tcp_ipv4 && !has_listening_tcp_ipv4) { std::shared_ptr descriptor = - create_descriptor(ip_configuration->whitelist); + create_descriptor( + initial_peers_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -276,13 +278,14 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici params.userTransports.push_back(descriptor); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding TCPv4 Transport to Participant " << ip_configuration->id << "."); + "Adding TCPv4 Transport to Participant " << initial_peers_configuration->id << "."); } if (has_connection_tcp_ipv6 && !has_listening_tcp_ipv6) { std::shared_ptr descriptor = - create_descriptor(ip_configuration->whitelist); + create_descriptor( + initial_peers_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -293,28 +296,30 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici params.userTransports.push_back(descriptor); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding TCPv6 Transport to Participant " << ip_configuration->id << "."); + "Adding TCPv6 Transport to Participant " << initial_peers_configuration->id << "."); } // If has UDP, create descriptor because it has not been created yet if (has_udp_ipv4) { std::shared_ptr descriptor = - create_descriptor(ip_configuration->whitelist); + create_descriptor( + initial_peers_configuration->whitelist); params.userTransports.push_back(descriptor); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding UDPv4 Transport to Participant " << ip_configuration->id << "."); + "Adding UDPv4 Transport to Participant " << initial_peers_configuration->id << "."); } if (has_udp_ipv6) { std::shared_ptr descriptor_v6 = - create_descriptor(ip_configuration->whitelist); + create_descriptor( + initial_peers_configuration->whitelist); params.userTransports.push_back(descriptor_v6); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Adding UDPv6 Transport to Participant " << ip_configuration->id << "."); + "Adding UDPv6 Transport to Participant " << initial_peers_configuration->id << "."); } // To avoid creating a multicast transport in UDP when non listening addresses @@ -337,7 +342,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici } logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, - "Configured Participant " << ip_configuration->id); + "Configured Participant " << initial_peers_configuration->id); return params; } From 34908451e0de9571833a0d40017fb2a0d8a86295 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 11:23:35 +0200 Subject: [PATCH 43/53] Change name ds_configuration -> discovery_server_configuration Signed-off-by: Lucia Echevarria --- .../rtps/DiscoveryServerParticipant.cpp | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index f5c6edff..0e577e31 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -48,12 +48,13 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const // Use default as base attributes fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); - std::shared_ptr ds_configuration = + std::shared_ptr discovery_server_configuration = std::static_pointer_cast(configuration_); // Auxiliary variable to save characters and improve readability - const core::types::GuidPrefix& discovery_server_guid_prefix = ds_configuration->discovery_server_guid_prefix; - const auto& tls_config = ds_configuration->tls_configuration; + const core::types::GuidPrefix& discovery_server_guid_prefix = + discovery_server_configuration->discovery_server_guid_prefix; + const auto& tls_config = discovery_server_configuration->tls_configuration; // Needed values to check at the end if descriptor must be set bool has_listening_addresses = false; @@ -69,14 +70,14 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const ///// // Set listening addresses - for (types::Address address : ds_configuration->listening_addresses) + for (types::Address address : discovery_server_configuration->listening_addresses) { if (!address.is_valid()) { // Invalid address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard listening address: " << address << - " in Participant " << ds_configuration->id << " initialization."); + " in Participant " << discovery_server_configuration->id << " initialization."); continue; } @@ -122,7 +123,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const else { descriptor = create_descriptor( - ds_configuration->whitelist); + discovery_server_configuration->whitelist); descriptor->add_listener_port(address.port()); descriptor->set_WAN_address(address.ip()); @@ -141,7 +142,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const has_listening_tcp_ipv6 = true; std::shared_ptr descriptor = - create_descriptor(ds_configuration->whitelist); + create_descriptor( + discovery_server_configuration->whitelist); descriptor->add_listener_port(address.port()); @@ -195,19 +197,19 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const params.defaultUnicastLocatorList.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Add listening address " << address << " to Participant " << ds_configuration->id << "."); + "Add listening address " << address << " to Participant " << discovery_server_configuration->id << "."); } ///// // Set connection addresses - for (types::DiscoveryServerConnectionAddress connection_address : ds_configuration->connection_addresses) + for (types::DiscoveryServerConnectionAddress connection_address : discovery_server_configuration->connection_addresses) { if (!connection_address.is_valid()) { // Invalid connection address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard connection address with remote server in Participant " << - ds_configuration->id << " initialization."); + discovery_server_configuration->id << " initialization."); continue; } @@ -218,7 +220,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const // Invalid ip address, continue with next one EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Discard connection address with remote server due to invalid ip address " << - address.ip() << " in Participant " << ds_configuration->id << + address.ip() << " in Participant " << discovery_server_configuration->id << " initialization."); continue; } @@ -261,7 +263,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const params.builtin.discovery_config.m_DiscoveryServers.push_back(locator); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Add connection address " << address << " to Server Participant " << ds_configuration->id << "."); + "Add connection address " << address << " to Server Participant " << + discovery_server_configuration->id << "."); } } @@ -280,8 +283,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const if (!has_connection_addresses) { EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Creating Participant " << ds_configuration->id << " without listening or connection addresses. " << - "It will not communicate with any other Participant."); + "Creating Participant " << discovery_server_configuration->id << + " without listening or connection addresses. It will not communicate with any other Participant."); } } @@ -296,7 +299,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const if (has_connection_tcp_ipv4 && !has_listening_tcp_ipv4) { std::shared_ptr descriptor = - create_descriptor(ds_configuration->whitelist); + create_descriptor( + discovery_server_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -307,12 +311,13 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const params.userTransports.push_back(descriptor); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding TCPv4 Transport to Participant " << ds_configuration->id << "."); + "Adding TCPv4 Transport to Participant " << discovery_server_configuration->id << "."); } if (has_connection_tcp_ipv6 && !has_listening_tcp_ipv6) { std::shared_ptr descriptor = - create_descriptor(ds_configuration->whitelist); + create_descriptor( + discovery_server_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -323,31 +328,33 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const params.userTransports.push_back(descriptor); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding TCPv6 Transport to Participant " << ds_configuration->id << "."); + "Adding TCPv6 Transport to Participant " << discovery_server_configuration->id << "."); } // If has UDP, create descriptor because it has not been created yet if (has_udp_ipv4) { std::shared_ptr descriptor = - create_descriptor(ds_configuration->whitelist); + create_descriptor( + discovery_server_configuration->whitelist); params.userTransports.push_back(descriptor); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding UDPv4 Transport to Participant " << ds_configuration->id << "."); + "Adding UDPv4 Transport to Participant " << discovery_server_configuration->id << "."); } if (has_udp_ipv6) { std::shared_ptr descriptor_v6 = - create_descriptor(ds_configuration->whitelist); + create_descriptor( + discovery_server_configuration->whitelist); params.userTransports.push_back(descriptor_v6); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Adding UDPv6 Transport to Participant " << ds_configuration->id << "."); + "Adding UDPv6 Transport to Participant " << discovery_server_configuration->id << "."); } logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, - "Configured Participant " << ds_configuration->id << " with server guid: " << + "Configured Participant " << discovery_server_configuration->id << " with server guid: " << discovery_server_guid_prefix); return params; From 74daf38bf425d93d4fac59b87ab4ce956c4b4133 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 11:40:27 +0200 Subject: [PATCH 44/53] Use dynamic_pointer_cast instead of static_pointer_cast in reckon_participant_attributes_ Signed-off-by: Lucia Echevarria --- .../src/cpp/participant/rtps/DiscoveryServerParticipant.cpp | 2 +- .../src/cpp/participant/rtps/InitialPeersParticipant.cpp | 2 +- .../src/cpp/participant/rtps/SimpleParticipant.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index 0e577e31..28af2a44 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -49,7 +49,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); std::shared_ptr discovery_server_configuration = - std::static_pointer_cast(configuration_); + std::dynamic_pointer_cast(configuration_); // Auxiliary variable to save characters and improve readability const core::types::GuidPrefix& discovery_server_guid_prefix = diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index 99adbb06..dac8070f 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -44,7 +44,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); std::shared_ptr initial_peers_configuration = - std::static_pointer_cast(configuration_); + std::dynamic_pointer_cast(configuration_); // Auxiliary variable to save characters and improve readability const auto& tls_config = initial_peers_configuration->tls_configuration; diff --git a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp index 2312821e..7cf5b33c 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp @@ -46,7 +46,7 @@ SimpleParticipant::reckon_participant_attributes_() const fastdds::rtps::RTPSParticipantAttributes params = CommonParticipant::reckon_participant_attributes_(); std::shared_ptr simple_configuration = - std::static_pointer_cast(configuration_); + std::dynamic_pointer_cast(configuration_); // Configure Participant transports if (simple_configuration->transport == core::types::TransportDescriptors::builtin) From aac932ce10c764680d2dd6e5728c9dc7a3de426f Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 12:08:08 +0200 Subject: [PATCH 45/53] Change function descriptions in CommonParticipant Signed-off-by: Lucia Echevarria --- .../participant/rtps/CommonParticipant.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp index e6400ccd..885605d0 100644 --- a/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp +++ b/ddspipe_participants/include/ddspipe_participants/participant/rtps/CommonParticipant.hpp @@ -207,9 +207,8 @@ class CommonParticipant // RTPS specific methods /** - * @brief Virtual method that gives the common std attributes for a Participant. + * @brief Virtual method that sets the common properties of std attributes for a Participant. * - * @note This method must be specialized from inherit classes. */ virtual fastdds::rtps::RTPSParticipantAttributes add_participant_att_properties_( fastdds::rtps::RTPSParticipantAttributes& params) const; @@ -217,7 +216,6 @@ class CommonParticipant /** * @brief Virtual method that gives the std attributes for a Participant. * - * @note This method must be specialized from inherit classes. */ virtual fastdds::rtps::RTPSParticipantAttributes reckon_participant_attributes_() const; From 225fdb6e30c2ec3055bb0a744fec7d5f22971967 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 12:08:46 +0200 Subject: [PATCH 46/53] CHange char sequence message in tests Signed-off-by: Lucia Echevarria --- .../unittest/types/dynamic_types/types/msgs/char_sequence.msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg index bf4b2456..467a04b3 100644 --- a/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg +++ b/ddspipe_core/test/unittest/types/dynamic_types/types/msgs/char_sequence.msg @@ -1 +1 @@ -int8[] chars +char[] chars From aa1a682b6ee9c0c2dcdd7c7b09ec7eb436d0202d Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 16:35:49 +0200 Subject: [PATCH 47/53] Add clarification comment in TopicDataType::compute_key(SerializedPayload_t, ...) Signed-off-by: Lucia Echevarria --- ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp index 5cf5d73c..54280e63 100644 --- a/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp +++ b/ddspipe_participants/src/cpp/types/dds/TopicDataType.cpp @@ -107,6 +107,11 @@ bool TopicDataType::compute_key( fastdds::rtps::InstanceHandle_t& handle, bool /* = false */) { + // NOTE: This method returns false because Fast DDS always sends the KEY_HASH in inline QoS. + // As a result, the reader will never call this method when communicating with a Fast DDS writer. + // This would only be needed if receiving data from another DDS vendor that omits the KEY_HASH. + // Workaround in that case (different DDS vendor that omits KEY_HASH): set expects_inline_qos_ to + // true in DataReaderQos return false; } From fa147dcef81befe4832ff60a1fe178f778e29a5b Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 9 Sep 2024 16:37:05 +0200 Subject: [PATCH 48/53] Fix YamlGetEntityGuidPrefixTest.get_guidprefix_explicitly test Signed-off-by: Lucia Echevarria --- .../unittest/entities/guid/YamlGetEntityGuidPrefixTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ddspipe_yaml/test/unittest/entities/guid/YamlGetEntityGuidPrefixTest.cpp b/ddspipe_yaml/test/unittest/entities/guid/YamlGetEntityGuidPrefixTest.cpp index e71c0366..ff562c00 100644 --- a/ddspipe_yaml/test/unittest/entities/guid/YamlGetEntityGuidPrefixTest.cpp +++ b/ddspipe_yaml/test/unittest/entities/guid/YamlGetEntityGuidPrefixTest.cpp @@ -89,9 +89,9 @@ TEST(YamlGetEntityGuidPrefixTest, get_guidprefix_explicitly) Yaml yml; yml["guid_prefix"] = yml_gp; - ASSERT_THROW( + ASSERT_EQ( YamlReader::get(yml, "guid_prefix", LATEST), - eprosima::utils::ConfigurationException); + core::types::GuidPrefix()); } // TODO: this tests requires to modify fastrtps core::types::GuidPrefix >> operator so it returns a non valid guid From d2fa3fa336d07ec99c9f4b560b196caddc11c820 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 10 Sep 2024 11:59:23 +0200 Subject: [PATCH 49/53] Add comment clarifying the order of TypeIdentifiers (complete and minimal) in DdsTopic.type_identifiers Signed-off-by: Lucia Echevarria --- ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp index 89409de9..d90e2c1b 100644 --- a/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp +++ b/ddspipe_core/include/ddspipe_core/types/topic/dds/DdsTopic.hpp @@ -88,7 +88,7 @@ struct DdsTopic : public DistributedTopic //! Topic Type name std::string type_name{}; - //! Type Identifiers (complete and minimal) + //! Type Identifiers: first one is complete and second one minimal fastdds::dds::xtypes::TypeIdentifierPair type_identifiers; }; From 3012a05e81a6a315dd27f2793913c794294b73d1 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 10 Sep 2024 12:00:08 +0200 Subject: [PATCH 50/53] Fix Windows compilation Signed-off-by: Lucia Echevarria --- ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp index 1b5c92ca..5a344c14 100644 --- a/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp +++ b/ddspipe_core/include/ddspipe_core/types/dds/GuidPrefix.hpp @@ -34,7 +34,8 @@ class GuidPrefix : public fastdds::rtps::GuidPrefix_t public: //! Using parent constructors - using fastdds::rtps::GuidPrefix_t::GuidPrefix_t; + DDSPIPE_CORE_DllAPI + GuidPrefix () = default; //! Constructor from Parent class DDSPIPE_CORE_DllAPI From 75062c8789b4d7ab6a0a086d6c515676fa4b79b7 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 10 Sep 2024 12:13:07 +0200 Subject: [PATCH 51/53] Uncrustify Signed-off-by: Lucia Echevarria --- .../src/cpp/types/dynamic_types/schema_msg.cpp | 2 +- .../rtps/DiscoveryServerParticipant.cpp | 15 ++++++++------- .../participant/rtps/InitialPeersParticipant.cpp | 12 ++++++------ .../src/cpp/reader/rtps/CommonReader.cpp | 14 ++++++++------ .../src/cpp/writer/rtps/CommonWriter.cpp | 14 ++++++++------ 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp index f699bd8b..0df39b79 100644 --- a/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp +++ b/ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp @@ -137,7 +137,7 @@ std::string container_kind_to_str( if (this_array_size.size() != 1) { throw utils::UnsupportedException( - STR_ENTRY << "Failed to convert container type: Multidimensional arrays are not supported in ROS2."); + STR_ENTRY << "Failed to convert container type: Multidimensional arrays are not supported in ROS2."); } std::stringstream ss; diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index 28af2a44..8dc1dd9a 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -143,7 +143,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const std::shared_ptr descriptor = create_descriptor( - discovery_server_configuration->whitelist); + discovery_server_configuration->whitelist); descriptor->add_listener_port(address.port()); @@ -202,7 +202,8 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const ///// // Set connection addresses - for (types::DiscoveryServerConnectionAddress connection_address : discovery_server_configuration->connection_addresses) + for (types::DiscoveryServerConnectionAddress connection_address : + discovery_server_configuration->connection_addresses) { if (!connection_address.is_valid()) { @@ -264,7 +265,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, "Add connection address " << address << " to Server Participant " << - discovery_server_configuration->id << "."); + discovery_server_configuration->id << "."); } } @@ -300,7 +301,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const { std::shared_ptr descriptor = create_descriptor( - discovery_server_configuration->whitelist); + discovery_server_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -317,7 +318,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const { std::shared_ptr descriptor = create_descriptor( - discovery_server_configuration->whitelist); + discovery_server_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -336,7 +337,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const { std::shared_ptr descriptor = create_descriptor( - discovery_server_configuration->whitelist); + discovery_server_configuration->whitelist); params.userTransports.push_back(descriptor); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, @@ -346,7 +347,7 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const { std::shared_ptr descriptor_v6 = create_descriptor( - discovery_server_configuration->whitelist); + discovery_server_configuration->whitelist); params.userTransports.push_back(descriptor_v6); logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT, diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index dac8070f..405c3802 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -117,7 +117,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici else { descriptor = create_descriptor( - initial_peers_configuration->whitelist); + initial_peers_configuration->whitelist); descriptor->add_listener_port(address.port()); descriptor->set_WAN_address(address.ip()); @@ -137,7 +137,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici std::shared_ptr descriptor = create_descriptor( - initial_peers_configuration->whitelist); + initial_peers_configuration->whitelist); descriptor->add_listener_port(address.port()); @@ -267,7 +267,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici { std::shared_ptr descriptor = create_descriptor( - initial_peers_configuration->whitelist); + initial_peers_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -285,7 +285,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici { std::shared_ptr descriptor = create_descriptor( - initial_peers_configuration->whitelist); + initial_peers_configuration->whitelist); // Enable TLS if (tls_config.is_active()) @@ -304,7 +304,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici { std::shared_ptr descriptor = create_descriptor( - initial_peers_configuration->whitelist); + initial_peers_configuration->whitelist); params.userTransports.push_back(descriptor); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, @@ -315,7 +315,7 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici { std::shared_ptr descriptor_v6 = create_descriptor( - initial_peers_configuration->whitelist); + initial_peers_configuration->whitelist); params.userTransports.push_back(descriptor_v6); logDebug(DDSPIPE_INITIALPEERS_PARTICIPANT, diff --git a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp index e8769ac2..befc5e95 100644 --- a/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp +++ b/ddspipe_participants/src/cpp/reader/rtps/CommonReader.cpp @@ -340,11 +340,13 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; - auto try_get_type_information = [&](const fastdds::dds::xtypes::TypeIdentifierPair& identifiers) -> bool { - return fastdds::dds::RETCODE_OK == - fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - identifiers, type_information); - }; + auto try_get_type_information = [&](const fastdds::dds::xtypes::TypeIdentifierPair& identifiers) -> bool + { + return fastdds::dds::RETCODE_OK == + fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry(). + get_type_information( + identifiers, type_information); + }; if (!try_get_type_information(topic.type_identifiers)) { @@ -361,7 +363,7 @@ fastdds::rtps::TopicDescription CommonReader::reckon_topic_description_( if (!try_get_type_information(minimal_only)) { EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, - "Failed to get TypeInformation for type " << topic.type_name); + "Failed to get TypeInformation for type " << topic.type_name); return topic_description; } diff --git a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp index b239713d..f38eaf51 100644 --- a/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp +++ b/ddspipe_participants/src/cpp/writer/rtps/CommonWriter.cpp @@ -400,11 +400,13 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( // Set TypeInformation of the discovered type fastdds::dds::xtypes::TypeInformation type_information; - auto try_get_type_information = [&](const fastdds::dds::xtypes::TypeIdentifierPair& identifiers) -> bool { - return fastdds::dds::RETCODE_OK == - fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information( - identifiers, type_information); - }; + auto try_get_type_information = [&](const fastdds::dds::xtypes::TypeIdentifierPair& identifiers) -> bool + { + return fastdds::dds::RETCODE_OK == + fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry(). + get_type_information( + identifiers, type_information); + }; if (!try_get_type_information(topic.type_identifiers)) { @@ -421,7 +423,7 @@ fastdds::rtps::TopicDescription CommonWriter::reckon_topic_description_( if (!try_get_type_information(minimal_only)) { EPROSIMA_LOG_WARNING(DDSPIPE_RTPS_COMMONREADER_LISTENER, - "Failed to get TypeInformation for type " << topic.type_name); + "Failed to get TypeInformation for type " << topic.type_name); return topic_description; } From b0c80722b05f831fd5b59e853105bedce5da409b Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 10 Sep 2024 14:34:03 +0200 Subject: [PATCH 52/53] Check if ParticipantConfiguration is nullptr after cast in reckon_participant_attributes_ Signed-off-by: Lucia Echevarria --- .../cpp/participant/rtps/DiscoveryServerParticipant.cpp | 6 ++++++ .../src/cpp/participant/rtps/InitialPeersParticipant.cpp | 7 +++++++ .../src/cpp/participant/rtps/SimpleParticipant.cpp | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index 8dc1dd9a..c56ac735 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -51,6 +51,12 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const std::shared_ptr discovery_server_configuration = std::dynamic_pointer_cast(configuration_); + if(discovery_server_configuration == nullptr) + { + throw utils::ConfigurationException( + "Failed to cast ParticipantConfiguration to DiscoveryServerParticipantConfiguration."); + } + // Auxiliary variable to save characters and improve readability const core::types::GuidPrefix& discovery_server_guid_prefix = discovery_server_configuration->discovery_server_guid_prefix; diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index 405c3802..6e795e5f 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -46,6 +47,12 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici std::shared_ptr initial_peers_configuration = std::dynamic_pointer_cast(configuration_); + if(initial_peers_configuration == nullptr) + { + throw utils::ConfigurationException( + "Failed to cast ParticipantConfiguration to InitialPeersParticipantConfiguration."); + } + // Auxiliary variable to save characters and improve readability const auto& tls_config = initial_peers_configuration->tls_configuration; diff --git a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp index 7cf5b33c..4c039bd3 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include namespace eprosima { @@ -48,6 +50,11 @@ SimpleParticipant::reckon_participant_attributes_() const std::shared_ptr simple_configuration = std::dynamic_pointer_cast(configuration_); + if(simple_configuration == nullptr) + { + throw utils::ConfigurationException("Failed to cast ParticipantConfiguration to SimpleParticipantConfiguration."); + } + // Configure Participant transports if (simple_configuration->transport == core::types::TransportDescriptors::builtin) { From 5154606ad733dbc3f3915be87412e3145e52edf0 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 10 Sep 2024 14:39:17 +0200 Subject: [PATCH 53/53] Fix uncrustify Signed-off-by: Lucia Echevarria --- .../src/cpp/participant/rtps/DiscoveryServerParticipant.cpp | 4 ++-- .../src/cpp/participant/rtps/InitialPeersParticipant.cpp | 4 ++-- .../src/cpp/participant/rtps/SimpleParticipant.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp index c56ac735..24ee2f96 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/DiscoveryServerParticipant.cpp @@ -51,10 +51,10 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const std::shared_ptr discovery_server_configuration = std::dynamic_pointer_cast(configuration_); - if(discovery_server_configuration == nullptr) + if (discovery_server_configuration == nullptr) { throw utils::ConfigurationException( - "Failed to cast ParticipantConfiguration to DiscoveryServerParticipantConfiguration."); + "Failed to cast ParticipantConfiguration to DiscoveryServerParticipantConfiguration."); } // Auxiliary variable to save characters and improve readability diff --git a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp index 6e795e5f..f639723f 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/InitialPeersParticipant.cpp @@ -47,10 +47,10 @@ fastdds::rtps::RTPSParticipantAttributes InitialPeersParticipant::reckon_partici std::shared_ptr initial_peers_configuration = std::dynamic_pointer_cast(configuration_); - if(initial_peers_configuration == nullptr) + if (initial_peers_configuration == nullptr) { throw utils::ConfigurationException( - "Failed to cast ParticipantConfiguration to InitialPeersParticipantConfiguration."); + "Failed to cast ParticipantConfiguration to InitialPeersParticipantConfiguration."); } // Auxiliary variable to save characters and improve readability diff --git a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp index 4c039bd3..2aeb3c17 100644 --- a/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp +++ b/ddspipe_participants/src/cpp/participant/rtps/SimpleParticipant.cpp @@ -50,7 +50,7 @@ SimpleParticipant::reckon_participant_attributes_() const std::shared_ptr simple_configuration = std::dynamic_pointer_cast(configuration_); - if(simple_configuration == nullptr) + if (simple_configuration == nullptr) { throw utils::ConfigurationException("Failed to cast ParticipantConfiguration to SimpleParticipantConfiguration."); }